Should data-foo-bar be accessible via .data( 'fooBar' ) as well as .data( 'foo-bar' ) ?
|Reported by:||cowboy||Owned by:|
I was looking at the section of the HTML5 draft on custom data attributes and noticed this text:
Hyphenated names become camel-cased. For example, data-foo-bar="" becomes element.dataset.fooBar.
Is this something jQuery should handle?
This is how jQuery currently behaves:
$('<div data-foo-bar="123"/>').data( 'foo-bar' ); // 123 $('<div data-foo-bar="123"/>').data( 'fooBar' ); // undefined
Should jQuery behave thusly?
$('<div data-foo-bar="123"/>').data( 'foo-bar' ); // 123 $('<div data-foo-bar="123"/>').data( 'fooBar' ); // 123
Change History (19)
comment:1 Changed 6 years ago by john
- Milestone 1.5 deleted
- Resolution set to wontfix
- Status changed from new to closed
comment:4 Changed 6 years ago by snover
- Resolution wontfix deleted
- Status changed from closed to reopened
comment:8 Changed 6 years ago by snover
- Milestone set to 1.5
- Priority changed from undecided to high
- Status changed from reopened to open
- Version changed from 1.4.3 to 1.4.4
comment:17 Changed 5 years ago by Alexis Abril
- Resolution set to fixed
- Status changed from open to closed