aboutsummaryrefslogtreecommitdiffstats
path: root/src/core.js
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2009-01-05 19:22:25 +0000
committerJohn Resig <jeresig@gmail.com>2009-01-05 19:22:25 +0000
commitebd9205fdb7f14b98301c4c183e9d6a51420ad0e (patch)
tree98fa41b24d57ff6b6967ade3e6f14c8b9e252605 /src/core.js
parent122b672f704cca094de50dfef05e88faa84cb51d (diff)
downloadjquery-ebd9205fdb7f14b98301c4c183e9d6a51420ad0e.tar.gz
jquery-ebd9205fdb7f14b98301c4c183e9d6a51420ad0e.zip
Make sure that if no ownerDocument is available that we fall back to the node itself (likely the document).
Diffstat (limited to 'src/core.js')
-rw-r--r--src/core.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core.js b/src/core.js
index d779061a5..9222e0a12 100644
--- a/src/core.js
+++ b/src/core.js
@@ -475,11 +475,11 @@ jQuery.fn = jQuery.prototype = {
domManip: function( args, table, callback ) {
if ( this[0] ) {
- var fragment = this[0].ownerDocument.createDocumentFragment(),
- scripts = jQuery.clean( args, this[0].ownerDocument, fragment ),
+ var fragment = (this[0].ownerDocument || this[0]).createDocumentFragment(),
+ scripts = jQuery.clean( args, (this[0].ownerDocument || this[0]), fragment ),
first = fragment.firstChild,
extra = this.length > 1 ? fragment.cloneNode(true) : fragment;
-
+
if ( first )
for ( var i = 0, l = this.length; i < l; i++ )
callback.call( root(this[i], first), i > 0 ? extra.cloneNode(true) : fragment );