aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/attributes.js
diff options
context:
space:
mode:
authorOleg <markelog@gmail.com>2012-10-02 03:36:54 +0400
committerDave Methvin <dave.methvin@gmail.com>2012-12-13 09:29:40 -0500
commit13651f296d14b2400d703d1945065c0373862eb5 (patch)
tree7d4fac71aee5f325d4d31f8c2424022b705614bd /test/unit/attributes.js
parent0018f7700bf8004d573c752ecbf66f299769c4de (diff)
downloadjquery-13651f296d14b2400d703d1945065c0373862eb5.tar.gz
jquery-13651f296d14b2400d703d1945065c0373862eb5.zip
Fix #9646. Cloned nodes shouldn't affect original in IE7. Close gh-947.
Diffstat (limited to 'test/unit/attributes.js')
-rw-r--r--test/unit/attributes.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index 4d1a72b4f..4fb3f776e 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -156,6 +156,30 @@ test( "attr(String)", function() {
$form = jQuery("#form").attr( "enctype", "multipart/form-data" );
equal( $form.prop("enctype"), "multipart/form-data", "Set the enctype of a form (encoding in IE6/7 #6743)" );
+
+});
+
+test( "attr(String) on cloned elements, #9646", function() {
+ expect( 4 );
+
+ var div,
+ input = jQuery("<input name='tester' />");
+
+ input.attr("name");
+
+ strictEqual( input.clone( true ).attr( "name", "test" )[ 0 ].name, "test", "Name attribute should be changed on cloned element" );
+
+ div = jQuery("<div id='tester' />");
+ div.attr("id");
+
+ strictEqual( div.clone( true ).attr( "id", "test" )[ 0 ].id, "test", "Id attribute should be changed on cloned element" );
+
+ input = jQuery("<input value='tester' />");
+ input.attr("value");
+
+ strictEqual( input.clone( true ).attr( "value", "test" )[ 0 ].value, "test", "Value attribute should be changed on cloned element" );
+
+ strictEqual( input.clone( true ).attr( "value", 42 )[ 0 ].value, "42", "Value attribute should be changed on cloned element" );
});
test( "attr(String) in XML Files", function() {