aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2009-01-12 14:07:14 +0000
committerJohn Resig <jeresig@gmail.com>2009-01-12 14:07:14 +0000
commitea7837776022fe9f2ccdf00ede30728e6f24d919 (patch)
tree8c09ad2ad027f80ce7e1367c40bcaa935ed593f8 /test
parent0c97178553606c01b999441836e23f9f36c645a3 (diff)
downloadjquery-ea7837776022fe9f2ccdf00ede30728e6f24d919.tar.gz
jquery-ea7837776022fe9f2ccdf00ede30728e6f24d919.zip
Only try to wrap the element if it's not disconnected, fixed #3828.
Diffstat (limited to 'test')
-rw-r--r--test/unit/core.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/unit/core.js b/test/unit/core.js
index 8483361a1..80a93353c 100644
--- a/test/unit/core.js
+++ b/test/unit/core.js
@@ -751,7 +751,7 @@ test("text()", function() {
});
test("wrap(String|Element)", function() {
- expect(8);
+ expect(10);
var defaultText = 'Try them out:'
var result = jQuery('#first').wrap('<div class="red"><span></span></div>').text();
equals( defaultText, result, 'Check for wrapping of on-the-fly html' );
@@ -776,6 +776,11 @@ test("wrap(String|Element)", function() {
j.wrap("<i></i>");
equals( jQuery("#nonnodes > i").length, 3, "Check node,textnode,comment wraps ok" );
equals( jQuery("#nonnodes > i").text(), j.text() + j[1].nodeValue, "Check node,textnode,comment wraps doesn't hurt text" );
+
+ // Try wrapping a disconnected node
+ j = jQuery("<label/>").wrap("<li/>");
+ equals( j[0].nodeName, "LABEL", "Element is a label" );
+ equals( j[0].parentNode.nodeName, "LI", "Element has been wrapped" );
});
test("wrapAll(String|Element)", function() {