]> source.dussan.org Git - jquery.git/commitdiff
Update "Fix #6593. Don't trigger `change` event twice when simulating it on IE."
authorDave Methvin <dave.methvin@gmail.com>
Fri, 9 Sep 2011 03:31:47 +0000 (23:31 -0400)
committertimmywil <timmywillisn@gmail.com>
Mon, 19 Sep 2011 19:42:32 +0000 (15:42 -0400)
This reverts commit 3d0de29d5615c1b1d74c72e6272484961a4ba243.

src/event.js

index 688aa9fb0e9451e15c224e08e172ed1766d6f468..ea9882d058ab07cdb01a416b6290872dae13b631 100644 (file)
@@ -799,8 +799,8 @@ if ( !jQuery.support.changeBubbles ) {
                        jQuery._data( elem, "_change_data", val );
                }
 
-               if ( val !== old && old != null && elem.parentNode ) {
-                       simulate( "change", elem.parentNode,  e, true );
+               if ( val !== old && old != null ) {
+                       simulate( "change", elem,  e, true );
                }
        },
 
@@ -852,21 +852,20 @@ if ( !jQuery.support.changeBubbles ) {
        jQuery.event.special.change = {
 
                setup: function( data, namespaces ) {
-                       if ( this.type === "file" ) {
+                       // If this is a real input element, no need to fake change
+                       if ( rformElems.test( this.nodeName ) ) {
                                return false;
                        }
-
                        for ( var type in changeFilters ) {
                                jQuery.event.add( this, type + "._change", changeFilters[ type ] );
                        }
-
-                       return rformElems.test( this.nodeName );
                },
 
                teardown: function( namespaces ) {
+                       if ( rformElems.test( this.nodeName ) ) {
+                               return false;
+                       }
                        jQuery.event.remove( this, "._change" );
-
-                       return rformElems.test( this.nodeName );
                }
        };
 }