Skip to content

Commit

Permalink
jquery core: Fixed #5202. Fixing selector generation when a manipulat…
Browse files Browse the repository at this point in the history
…ion function receives a jQuery object.
  • Loading branch information
flesler committed Sep 14, 2009
1 parent 66c58e9 commit 0790989
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/manipulation.js
Expand Up @@ -295,8 +295,7 @@ jQuery.each({
jQuery.fn[ original ].apply( jQuery(insert[i]), elems );
ret = ret.concat( elems );
}

return this.pushStack( ret, name, selector );
return this.pushStack( ret, name, insert.selector );
};
});

Expand Down
9 changes: 8 additions & 1 deletion test/unit/core.js
Expand Up @@ -62,7 +62,7 @@ test("jQuery()", function() {
});

test("selector state", function() {
expect(30);
expect(31);

var test;

Expand Down Expand Up @@ -126,6 +126,13 @@ test("selector state", function() {
test = jQuery("#main").eq(0);
equals( test.selector, "#main.slice(0,1)", "#main eq Selector" );
equals( test.context, document, "#main eq Context" );

var d = "<div />";
equals(
jQuery(d).appendTo(jQuery(d)).selector,
jQuery(d).appendTo(d).selector,
"manipulation methods make same selector for jQuery objects"
);
});

test("browser", function() {
Expand Down

0 comments on commit 0790989

Please sign in to comment.