diff options
author | Corey Frang <gnarf@gnarf.net> | 2013-04-24 16:07:15 -0400 |
---|---|---|
committer | Corey Frang <gnarf@gnarf.net> | 2013-04-24 17:09:30 -0400 |
commit | 55e319aa52eb828a3a4c2298aa75b6d15cfa06f8 (patch) | |
tree | 78ead6c21e7341eb1a015c53672843acc20cf78c /test/unit/data.js | |
parent | 3a6194076b8b7ab5a9d9f5e6ec602db2ab427d3e (diff) | |
download | jquery-55e319aa52eb828a3a4c2298aa75b6d15cfa06f8.tar.gz jquery-55e319aa52eb828a3a4c2298aa75b6d15cfa06f8.zip |
Fixes #13815: Ensure each element has its own private data object - Tests by @rwldrn
Diffstat (limited to 'test/unit/data.js')
-rw-r--r-- | test/unit/data.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/data.js b/test/unit/data.js index a0361504a..c2cfe3f3f 100644 --- a/test/unit/data.js +++ b/test/unit/data.js @@ -244,6 +244,18 @@ test("jQuery(plain Object).data(String, Object).data(String)", function() { deepEqual( $obj[0], { exists: true }, "removeData does not clear the object" ); }); +test(".data(object) does not retain references. #13815", function() { + expect( 2 ); + + var $divs = jQuery("<div></div><div></div>").appendTo("#qunit-fixture"); + + $divs.data({ "type": "foo" }); + $divs.eq( 0 ).data( "type", "bar" ); + + equal( $divs.eq( 0 ).data("type"), "bar", "Correct updated value" ); + equal( $divs.eq( 1 ).data("type"), "foo", "Original value retained" ); +}); + test("data-* attributes", function() { expect(40); var prop, i, l, metadata, elem, |