X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fevent.js;h=c3c978b7f1c8bf800872530ba626b0f14c35aced;hb=19cd84cf3261ee412a2521df73dcf9d6cfba04a3;hp=9d77314b59af37671b7efa59f84351e3c108d1dc;hpb=f3474c00cd6d9e5fd61b6ef1562003e9986ad67d;p=jquery.git diff --git a/src/event.js b/src/event.js index 9d77314..c3c978b 100644 --- a/src/event.js +++ b/src/event.js @@ -518,9 +518,10 @@ var withinElement = function( event ) { } }; +// Create mouseenter and mouseleave events jQuery.each({ - mouseover: 'mouseenter', - mouseout: 'mouseleave' + mouseover: "mouseenter", + mouseout: "mouseleave" }, function( orig, fix ) { jQuery.event.special[ fix ] = { setup: function(){ @@ -532,12 +533,40 @@ jQuery.each({ }; }); +// Create "bubbling" focus and blur events +jQuery.each({ + focus: "focusin", + blur: "focusout" +}, function( orig, fix ){ + var event = jQuery.event, + special = event.special, + handle = event.handle; + + function ieHandler() { + arguments[0].type = orig; + return handle.apply(this, arguments); + } + + special[orig] = { + setup:function() { + if ( this.addEventListener ) + this.addEventListener( orig, handle, true ); + else + jQuery.event.add( this, fix, ieHandler ); + }, + teardown:function() { + if ( this.removeEventListener ) + this.removeEventListener( orig, handle, true ); + else + jQuery.event.remove( this, fix, ieHandler ); + } + }; +}); + jQuery.fn.extend({ bind: function( type, data, fn, thisObject ) { if ( jQuery.isFunction( data ) ) { - if ( fn !== undefined ) { - thisObject = fn; - } + thisObject = fn; fn = data; data = undefined; } @@ -549,9 +578,7 @@ jQuery.fn.extend({ one: function( type, data, fn, thisObject ) { if ( jQuery.isFunction( data ) ) { - if ( fn !== undefined ) { - thisObject = fn; - } + thisObject = fn; fn = data; data = undefined; }