From: Dave Methvin Date: Fri, 5 Aug 2011 14:45:05 +0000 (-0700) Subject: Merge pull request #456 from rwldrn/9318 X-Git-Tag: 1.6.3rc1~21 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b22c9046529852c7ce567df13397849e11e2b9cc;p=jquery.git Merge pull request #456 from rwldrn/9318 Improves support for arbitrary numbers in data keys. Fixes #9318 --- b22c9046529852c7ce567df13397849e11e2b9cc diff --cc test/unit/data.js index 55201b4e3,20e7f92fb..4e21f563e --- a/test/unit/data.js +++ b/test/unit/data.js @@@ -551,31 -554,3 +554,31 @@@ test("jQuery.data supports interoperabl }); }); +test("jQuery.data supports interoperable removal of hyphenated/camelCase properties", function() { + var div = jQuery("
", { id: "hyphened" }).appendTo("#qunit-fixture"), + datas = { + "non-empty": "a string", + "empty-string": "", + "one-value": 1, + "zero-value": 0, + "an-array": [], + "an-object": {}, + "bool-true": true, + "bool-false": false, + "some-json": '{ "foo": "bar" }' + }; + + expect( 27 ); + + jQuery.each( datas, function( key, val ) { + div.data( key, val ); + + deepEqual( div.data( key ), val, "get: " + key ); + deepEqual( div.data( jQuery.camelCase( key ) ), val, "get: " + jQuery.camelCase( key ) ); + + div.removeData( key ); + + equal( div.data( key ), undefined, "get: " + key ); + + }); - }); ++});