Fixed an issue with domManip where the incorrect clone fragments were being used for elements.

This commit is contained in:
John Resig 2008-12-19 06:58:18 +00:00
parent 80a6a91347
commit 18ee5a93a2

View file

@ -501,11 +501,12 @@ jQuery.fn = jQuery.prototype = {
if ( this[0] ) { if ( this[0] ) {
var fragment = document.createDocumentFragment(), var fragment = document.createDocumentFragment(),
scripts = jQuery.clean( args, this[0].ownerDocument, fragment ), scripts = jQuery.clean( args, this[0].ownerDocument, fragment ),
first = fragment.firstChild; first = fragment.firstChild,
extra = this.length > 1 ? fragment.cloneNode(true) : fragment;
if ( first ) if ( first )
for ( var i = 0, l = this.length; i < l; i++ ) for ( var i = 0, l = this.length; i < l; i++ )
callback.call( root(this[i], first), this.length > 1 ? fragment.cloneNode(true) : fragment ); callback.call( root(this[i], first), i > 0 ? extra.cloneNode(true) : fragment );
if ( scripts ) if ( scripts )
jQuery.each( scripts, evalScript ); jQuery.each( scripts, evalScript );