aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2012-02-17 14:17:20 -0500
committerDave Methvin <dave.methvin@gmail.com>2012-02-23 23:09:31 -0500
commitdec2804c783003c13d356ed3fec664c3ac4b05ee (patch)
treee9e212208dfac982cad404874d76956bbf100bb6 /test
parentf36568324d1b68101cc6e8933b94db3bc8591fad (diff)
downloadjquery-dec2804c783003c13d356ed3fec664c3ac4b05ee.tar.gz
jquery-dec2804c783003c13d356ed3fec664c3ac4b05ee.zip
Fix #11359: preserve contents for cloned scripts
Diffstat (limited to 'test')
-rw-r--r--test/unit/manipulation.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js
index 49402b8a3..21d1f5f93 100644
--- a/test/unit/manipulation.js
+++ b/test/unit/manipulation.js
@@ -1169,6 +1169,15 @@ test("clone()", function() {
equal( jQuery("body").clone().children()[0].id, "qunit-header", "Make sure cloning body works" );
});
+test("clone(script type=non-javascript) (#11359)", function() {
+ expect(3);
+ var src = jQuery("<script type='text/filler'>Lorem ipsum dolor sit amet</script><q><script type='text/filler'>consectetur adipiscing elit</script></q>");
+ var dest = src.clone();
+ equal( dest[0].text, "Lorem ipsum dolor sit amet", "Cloning preserves script text" );
+ equal( dest.last().html(), src.last().html(), "Cloning preserves nested script text" );
+ ok( /^\s*<scr.pt\s+type=['"]?text\/filler['"]?\s*>consectetur adipiscing elit<\/scr.pt>\s*$/i.test( dest.last().html() ), "Cloning preserves nested script text" );
+});
+
test("clone(form element) (Bug #3879, #6655)", function() {
expect(5);
var element = jQuery("<select><option>Foo</option><option selected>Bar</option></select>");