Fixes #7328. When getting data- attributes, after-cap any embedded dashes per the W3C HTML5 spec.
This commit is contained in:
parent
8c40c00fac
commit
8c318bf414
2 changed files with 26 additions and 5 deletions
|
@ -485,4 +485,21 @@ if (window.JSON && window.JSON.stringify) {
|
|||
|
||||
equals( JSON.stringify(obj), '{"foo":"bar"}', "Expando is hidden from JSON.stringify" );
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
test("jQuery.data should follow html5 specification regarding camel casing", function() {
|
||||
expect(6);
|
||||
|
||||
var div = jQuery("<div id='myObject' data-foo='a' data-foo-bar='b' data-foo-bar-baz='c'></div>")
|
||||
.prependTo("body");
|
||||
|
||||
equals(div.data().foo, "a", "Verify single word data-* key");
|
||||
equals(div.data().fooBar, "b", "Verify multiple word data-* key");
|
||||
equals(div.data().fooBarBaz, "c", "Verify multiple word data-* key");
|
||||
|
||||
equals(div.data("foo"), "a", "Verify single word data-* key");
|
||||
equals(div.data("fooBar"), "b", "Verify multiple word data-* key");
|
||||
equals(div.data("fooBarBaz"), "c", "Verify multiple word data-* key");
|
||||
|
||||
div.remove();
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue