Make sure that data properties with hyphens are always accessed/set using camelCase. Fixes #9124.
This commit is contained in:
parent
419b5e5e2a
commit
a5e407cafb
2 changed files with 9 additions and 4 deletions
|
@ -488,7 +488,7 @@ if (window.JSON && window.JSON.stringify) {
|
|||
}
|
||||
|
||||
test("jQuery.data should follow html5 specification regarding camel casing", function() {
|
||||
expect(6);
|
||||
expect(8);
|
||||
|
||||
var div = jQuery("<div id='myObject' data-foo='a' data-foo-bar='b' data-foo-bar-baz='c'></div>")
|
||||
.prependTo("body");
|
||||
|
@ -501,5 +501,10 @@ test("jQuery.data should follow html5 specification regarding camel casing", fun
|
|||
equals(div.data("fooBar"), "b", "Verify multiple word data-* key");
|
||||
equals(div.data("fooBarBaz"), "c", "Verify multiple word data-* key");
|
||||
|
||||
div.data("foo-bar", "d");
|
||||
|
||||
equals(div.data("fooBar"), "d", "Verify updated data-* key");
|
||||
equals(div.data("foo-bar"), "d", "Verify updated data-* key");
|
||||
|
||||
div.remove();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue