jquery data: adding missing semicolons
[jquery.git] / src / event.js
index e911f29..c3c978b 100644 (file)
@@ -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;
                }
@@ -776,11 +803,10 @@ jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
 });
 
 // Prevent memory leaks in IE
-// And prevent errors on refresh with events like mouseover in other browsers
 // Window isn't included so as not to unbind existing unload events
 // More info:
 //  - http://isaacschlueter.com/2006/10/msie-memory-leaks/
-//  - https://bugzilla.mozilla.org/show_bug.cgi?id=252542
+/*@cc_on
 jQuery( window ).bind( 'unload', function() {
        for ( var id in jQuery.cache ) {
                // Skip the window
@@ -789,3 +815,4 @@ jQuery( window ).bind( 'unload', function() {
                }
        }
 });
+@*/