Make sure that expando properties aren't set on embed, applet, or object elements...
[jquery.git] / src / event.js
index d9401c9..128f78f 100644 (file)
@@ -569,9 +569,11 @@ jQuery.each({
 });
 
 // submit delegation
+if ( !jQuery.support.submitBubbles ) {
+
 jQuery.event.special.submit = {
        setup: function( data, namespaces, fn ) {
-               if ( !jQuery.support.submitBubbles && this.nodeName.toLowerCase() !== "form" ) {
+               if ( this.nodeName.toLowerCase() !== "form" ) {
                        jQuery.event.add(this, "click.specialSubmit." + fn.guid, function( e ) {
                                var elem = e.target, type = elem.type;
 
@@ -588,8 +590,6 @@ jQuery.event.special.submit = {
                                }
                        });
                }
-
-               return false;
        },
 
        remove: function( namespaces, fn ) {
@@ -598,7 +598,11 @@ jQuery.event.special.submit = {
        }
 };
 
+}
+
 // change delegation, happens here so we have bind.
+if ( !jQuery.support.changeBubbles ) {
+
 jQuery.event.special.change = {
        filters: {
                click: function( e ) { 
@@ -647,21 +651,16 @@ jQuery.event.special.change = {
                }
        },
        setup: function( data, namespaces, fn ) {
-               // return false if we bubble
-               if ( !jQuery.support.changeBubbles ) {
-                       for ( var type in changeFilters ) {
-                               jQuery.event.add( this, type + ".specialChange." + fn.guid, changeFilters[type] );
-                       }
+               for ( var type in changeFilters ) {
+                       jQuery.event.add( this, type + ".specialChange." + fn.guid, changeFilters[type] );
                }
                
                // always want to listen for change for trigger
                return false;
        },
        remove: function( namespaces, fn ) {
-               if ( !jQuery.support.changeBubbles ) {
-                       for ( var type in changeFilters ) {
-                               jQuery.event.remove( this, type + ".specialChange" + (fn ? "."+fn.guid : ""), changeFilters[type] );
-                       }
+               for ( var type in changeFilters ) {
+                       jQuery.event.remove( this, type + ".specialChange" + (fn ? "."+fn.guid : ""), changeFilters[type] );
                }
        }
 };
@@ -674,36 +673,26 @@ function trigger( type, elem, args ) {
 }
 
 // Create "bubbling" focus and blur events
-jQuery.each({
-       focus: "focusin",
-       blur: "focusout"
-}, function( orig, fix ){
-       var event = jQuery.event,
-               handle = event.handle;
-       
-       function ieHandler() { 
-               arguments[0].type = orig;
-               return handle.apply(this, arguments);
-       }
+if ( !jQuery.support.focusBubbles ) {
 
-       event.special[orig] = {
-               setup:function() {
-                       if ( this.addEventListener ) {
-                               this.addEventListener( orig, handle, true );
-                       } else {
-                               event.add( this, fix, ieHandler );
-                       }
+jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ){
+       event.special[ orig ] = {
+               setup: function() {
+                       jQuery.event.add( this, fix, ieHandler );
                }, 
-               teardown:function() { 
-                       if ( this.removeEventListener ) {
-                               this.removeEventListener( orig, handle, true );
-                       } else {
-                               event.remove( this, fix, ieHandler );
-                       }
+               teardown: function() { 
+                       jQuery.event.remove( this, fix, ieHandler );
                }
        };
+
+       function ieHandler() { 
+               arguments[0].type = orig;
+               return jQuery.event.handle.apply(this, arguments);
+       }
 });
 
+}
+
 jQuery.fn.extend({
        // TODO: make bind(), unbind() and one() DRY!
        bind: function( type, data, fn, thisObject ) {