From: David Serduke Date: Wed, 5 Dec 2007 00:26:13 +0000 (+0000) Subject: Fixed #1264. If you read the bug there were many proposed changes. As it turned... X-Git-Url: http://git.asbjorn.biz/?p=jquery.git;a=commitdiff_plain;h=74a132d944886379456d562990c8fb217ab332e3 Fixed #1264. If you read the bug there were many proposed changes. As it turned out most of them had already been implemented. The last ones necessary were in .domManip() with when a was 'this' and for .text(). Adding these last changes seems to make dom and text manipulation in IE frames possible. Unit test cases were added as well. In addition "submit.gif" was removed from the test suite index.html since it didn't exist. --- diff --git a/src/core.js b/src/core.js index ce487a1..0f27425 100644 --- a/src/core.js +++ b/src/core.js @@ -202,7 +202,7 @@ jQuery.fn = jQuery.prototype = { text: function( text ) { if ( typeof text != "object" && text != null ) - return this.empty().append( document.createTextNode( text ) ); + return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); var ret = ""; @@ -468,7 +468,7 @@ jQuery.fn = jQuery.prototype = { var obj = this; if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) ) - obj = this.getElementsByTagName("tbody")[0] || this.appendChild( document.createElement("tbody") ); + obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") ); var scripts = jQuery( [] ); diff --git a/test/data/iframe.html b/test/data/iframe.html new file mode 100644 index 0000000..3ff26e1 --- /dev/null +++ b/test/data/iframe.html @@ -0,0 +1,8 @@ + + + iframe + + +
span text
+ + diff --git a/test/index.html b/test/index.html index 2b0b685..4f68639 100644 --- a/test/index.html +++ b/test/index.html @@ -21,6 +21,8 @@
+ +
", ibody).append("").appendTo(ibody); + $("table", ibody).remove(); + equals( $("div", ibody).length, 1, "Check for JS error on add and delete of a table in IFrame" ); });
cell