Skip to main content

Bug Tracker

Side navigation

Ticket #978: msie_html_fix.patch


File msie_html_fix.patch, 1.2 KB (added by vmx, March 15, 2007 03:53PM UTC)

A patch to fix IE problems with append(), html() and wrap() in iframes

Index: jquery.js
===================================================================
--- jquery.js	(revision 1530)
+++ jquery.js	(working copy)
@@ -614,7 +614,7 @@
 	 */
 	wrap: function() {
 		// The elements to wrap the target around
-		var a = jQuery.clean(arguments);
+		var a = jQuery.clean(arguments, this[0].ownerDocument);
 
 		// Wrap each of the matched elements individually
 		return this.each(function(){
@@ -1122,7 +1122,7 @@
 	 */
 	domManip: function(args, table, dir, fn){
 		var clone = this.length > 1; 
-		var a = jQuery.clean(args);
+		var a = jQuery.clean(args, this[0].ownerDocument);
 		if ( dir < 0 )
 			a.reverse();
 
@@ -1440,9 +1440,13 @@
 		return ret;
 	},
 	
-	clean: function(a) {
+	clean: function(a, doc) {
 		var r = [];
+ 		var doc = doc;
 
+		if ( doc == undefined )
+			doc = document;
+
 		jQuery.each( a, function(i,arg){
 			if ( !arg ) return;
 
@@ -1452,7 +1456,7 @@
 			 // Convert html string into DOM nodes
 			if ( typeof arg == "string" ) {
 				// Trim whitespace, otherwise indexOf won't work as expected
-				var s = jQuery.trim(arg), div = document.createElement("div"), tb = [];
+				var s = jQuery.trim(arg), div = doc.createElement("div"), tb = [];
 
 				var wrap =
 					 // option or optgroup

Download in other formats:

Original Format