if ( data !== undefined ) {
return data;
}
+
+ // Attempt to get data from the cache
+ // with the key camelized
+ data = data_user.get( elem, camelKey );
+ if ( data !== undefined ) {
+ return data;
+ }
+
// Attempt to "discover" the data in
// HTML5 custom data-* attrs
data = dataAttr( elem, key, undefined );
div.remove();
});
-test("jQuery.data should not miss data with preset hyphenated property names", function() {
+test(".data should not miss preset data-* w/ hyphenated property names", function() {
expect(2);
});
});
+test(".data should not miss attr() set data-* with hyphenated property names", function() {
+ expect(1);
+
+ var div = jQuery("<div/>").appendTo("#qunit-fixture");
+
+ div.attr( "data-long-param", "test" );
+ div.data( "long-param", { a: 2 });
+
+ deepEqual( div.data("long-param"), { a: 2 }, "data with property long-param was found" );
+});
+
test("jQuery.data supports interoperable hyphenated/camelCase get/set of properties with arbitrary non-null|NaN|undefined values", function() {
var div = jQuery("<div/>", { id: "hyphened" }).appendTo("#qunit-fixture"),