#11746 closed bug (invalid)
$().data() return undefined if name contains uppercase
Reported by: | quaff | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | data | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Change History (5)
comment:1 Changed 11 years ago by
Component: | unfiled → data |
---|---|
Priority: | undecided → low |
Resolution: | → invalid |
Status: | new → closed |
comment:2 Changed 11 years ago by
should jquery auto lowercase and keep correspondence with html5 spec?
comment:3 Changed 11 years ago by
Nope, if you want mixed case you use the "-"
character. Please read these, and followup with a forum post if needed:
http://www.learningjquery.com/2011/09/using-jquerys-data-apis
comment:4 Changed 10 years ago by
Would be nice if this was explained as a note in the docs so we know where to start looking.
comment:5 Changed 10 years ago by
The linked article about data APIs goes into plenty of detail, and says this:
Rule: When accessing data taken from data-* attributes, and especially when accessing the data object directly, use the W3C camelCasing conventions.
In any documentation there will be a tradeoff between describing every detail in every situation on every API where it can arise versus making the documentation readable and comprehensible.
That's because it doesn't find the data-attribute. Data-attributes are automatically lowercased by the browser.
HTML5 spec: