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 );