Fixed an issue with domManip where the incorrect clone fragments were being used...
authorJohn Resig <jeresig@gmail.com>
Fri, 19 Dec 2008 06:58:18 +0000 (06:58 +0000)
committerJohn Resig <jeresig@gmail.com>
Fri, 19 Dec 2008 06:58:18 +0000 (06:58 +0000)
src/core.js

index 685ca2b..18069bc 100644 (file)
@@ -501,11 +501,12 @@ jQuery.fn = jQuery.prototype = {
                if ( this[0] ) {
                        var fragment = document.createDocumentFragment(),
                                scripts = jQuery.clean( args, this[0].ownerDocument, fragment ),
-                               first = fragment.firstChild;
+                               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), this.length > 1 ? fragment.cloneNode(true) : fragment );
+                                       callback.call( root(this[i], first), i > 0 ? extra.cloneNode(true) : fragment );
                        
                        if ( scripts )
                                jQuery.each( scripts, evalScript );