diff --git a/src/core.js b/src/core.js index ce487a10..0f274255 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 00000000..3ff26e16 --- /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 2b0b685f..4f686396 100644 --- a/test/index.html +++ b/test/index.html @@ -21,6 +21,8 @@
+ +