]> source.dussan.org Git - jquery.git/commitdiff
Merge pull request #456 from rwldrn/9318
authorDave Methvin <dave.methvin@gmail.com>
Fri, 5 Aug 2011 14:45:05 +0000 (07:45 -0700)
committerDave Methvin <dave.methvin@gmail.com>
Fri, 5 Aug 2011 14:45:05 +0000 (07:45 -0700)
Improves support for arbitrary numbers in data keys. Fixes #9318

1  2 
test/unit/data.js

index 55201b4e33f9f4e134fb7e02f713f0e9d7c22f2e,20e7f92fb1cc6976717a105ab1fab54262cfc0c2..4e21f563e7b54d227606183e199a71499ebb4287
@@@ -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("<div/>", { 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 );
 +
 +      });
++});