From 0790989eb60df9df884837c05f90bab14df0704e Mon Sep 17 00:00:00 2001 From: Ariel Flesler Date: Mon, 14 Sep 2009 18:03:18 +0000 Subject: [PATCH] jquery core: Fixed #5202. Fixing selector generation when a manipulation function receives a jQuery object. --- src/manipulation.js | 3 +-- test/unit/core.js | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/manipulation.js b/src/manipulation.js index 95e2f7a..5013838 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -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 ); }; }); diff --git a/test/unit/core.js b/test/unit/core.js index d2b0996..d3e0a44 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -62,7 +62,7 @@ test("jQuery()", function() { }); test("selector state", function() { - expect(30); + expect(31); var test; @@ -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 = "
"; + equals( + jQuery(d).appendTo(jQuery(d)).selector, + jQuery(d).appendTo(d).selector, + "manipulation methods make same selector for jQuery objects" + ); }); test("browser", function() { -- 1.7.10.4