Skip to main content

Bug Tracker

Side navigation

Ticket #2973: ie6-clone-events-patch.diff
File ie6-clone-events-patch.diff, 1.2 KB (added by futileohm, June 05, 2008 06:29PM UTC)

Actual patch with potential fix.

Index: src/core.js
===================================================================
--- src/core.js	(revision 5713)
+++ src/core.js	(working copy)
@@ -293,11 +293,27 @@
 
 		// Need to set the expando to null on the cloned set if it exists
 		// removeData doesn't work here, IE removes it from the original as well
-		// this is primarily for IE but the data expando shouldn't be copied over in any browser
-		var clone = ret.find("*").andSelf().each(function(){
+		// this is primarily for IE but the data expando shouldn't be copied over in any browser.
+		
+		// Because andSelf() calls add() which uses unique(), which will then
+		// potentially strip out some elements because of our unclean expandos,
+		// we have to clean the expandos separately instead of using one call
+		/*var clone = ret.find("*").andSelf().each(function(){
 			if ( this[ expando ] != undefined )
 				this[ expando ] = null;
+		});*/
+		
+		ret.find('*').each(function(){
+			if ( this[ expando ] != undefined )
+				this[ expando ] = null;
 		});
+		
+		ret.each(function(){
+			if ( this[ expando ] != undefined )
+				this[ expando ] = null;
+		});
+		
+		var clone = ret.find('*').andSelf();
 
 		// Copy the events from the original to the clone
 		if ( events === true )

Download in other formats:

Original Format