aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorNoah Sloan <noah.sloan@gmail.com>2010-02-01 21:48:05 -0500
committerjeresig <jeresig@gmail.com>2010-02-01 21:48:05 -0500
commit8660ea1ab61dd16aec1ed24ec549c6258292b96a (patch)
treead013af49b7b105cd9df6f57f18cb6a47ddba865 /test
parente76ba32cebc26108e15b2e0e03c5152624c1bad9 (diff)
downloadjquery-8660ea1ab61dd16aec1ed24ec549c6258292b96a.tar.gz
jquery-8660ea1ab61dd16aec1ed24ec549c6258292b96a.zip
Only detach the incoming elements to replaceWith if they're DOM nodes. Fixes #5986.
Diffstat (limited to 'test')
-rw-r--r--test/unit/manipulation.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js
index f921ea190..41ce8bb16 100644
--- a/test/unit/manipulation.js
+++ b/test/unit/manipulation.js
@@ -650,7 +650,7 @@ test("insertAfter(String|Element|Array&lt;Element&gt;|jQuery)", function() {
});
var testReplaceWith = function(val) {
- expect(15);
+ expect(17);
jQuery('#yahoo').replaceWith(val( '<b id="replace">buga</b>' ));
ok( jQuery("#replace")[0], 'Replace element with string' );
ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after string' );
@@ -661,6 +661,12 @@ var testReplaceWith = function(val) {
ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after element' );
reset();
+ jQuery("#main").append('<div id="bar"><div id="baz">Foo</div></div>');
+ jQuery('#baz').replaceWith("Baz");
+ equals( jQuery("#bar").text(),"Baz", 'Replace element with text' );
+ ok( !jQuery("#baz")[0], 'Verify that original element is gone, after element' );
+
+ reset();
jQuery('#yahoo').replaceWith(val( [document.getElementById('first'), document.getElementById('mark')] ));
ok( jQuery("#first")[0], 'Replace element with array of elements' );
ok( jQuery("#mark")[0], 'Replace element with array of elements' );
@@ -721,7 +727,7 @@ test("replaceWith(String|Element|Array&lt;Element&gt;|jQuery)", function() {
test("replaceWith(Function)", function() {
testReplaceWith(functionReturningObj);
- expect(16);
+ expect(18);
var y = jQuery("#yahoo")[0];