aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2009-12-09 13:28:58 -0800
committerJohn Resig <jeresig@gmail.com>2009-12-09 13:28:58 -0800
commit4b70f006f579fba24a882d80ca67f1971dbb4922 (patch)
treef3bb24c52928b8bbdaf19eff5ec713a434064d18 /test
parentf6a0bf6816f4e2e67382b1b13fdd3ff2ea4b22f8 (diff)
downloadjquery-4b70f006f579fba24a882d80ca67f1971dbb4922.tar.gz
jquery-4b70f006f579fba24a882d80ca67f1971dbb4922.zip
Made .clone(true) also copy over element data. Fixes #4191.
Diffstat (limited to 'test')
-rw-r--r--test/unit/manipulation.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js
index 4631ead61..6de3e14eb 100644
--- a/test/unit/manipulation.js
+++ b/test/unit/manipulation.js
@@ -549,7 +549,7 @@ test("replaceAll(String|Element|Array&lt;Element&gt;|jQuery)", function() {
});
test("clone()", function() {
- expect(28);
+ expect(30);
equals( 'This is a normal link: Yahoo', jQuery('#en').text(), 'Assert text for #en' );
var clone = jQuery('#yahoo').clone();
equals( 'Try them out:Yahoo', jQuery('#first').append(clone).text(), 'Check for clone' );
@@ -594,6 +594,11 @@ test("clone()", function() {
div = div.clone(true);
equals( div.length, 1, "One element cloned" );
equals( div[0].nodeName.toUpperCase(), "DIV", "DIV element cloned" );
+
+ div = jQuery("<div/>").data({ a: true, b: true });
+ div = div.clone(true);
+ equals( div.data("a"), true, "Data cloned." );
+ equals( div.data("b"), true, "Data cloned." );
});
if (!isLocal) {