Side navigation
#10368 closed bug (invalid)
Opened September 28, 2011 05:13PM UTC
Closed September 28, 2011 06:53PM UTC
IE's .data() returns empty object
Reported by: | psayre@sitecrafting.com | Owned by: | rwaldron |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | data | Version: | 1.6.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
It looks like there is a regression in 1.6.4 jQuery. Calling $('div').data() on <div data-elem-ID="HTML"></div> returns an empty object.
Attachments (0)
Change History (5)
Changed September 28, 2011 05:44PM UTC by comment:1
owner: | → psayre@sitecrafting.com |
---|---|
status: | new → pending |
Changed September 28, 2011 06:18PM UTC by comment:2
component: | unfiled → data |
---|---|
keywords: | → needsdocs |
milestone: | None → 1.next |
priority: | undecided → low |
Simply put, you're asking for invalid property identifiers... See: http://jsfiddle.net/rwaldron/qmLdX/
Changed September 28, 2011 06:26PM UTC by comment:3
status: | pending → new |
---|
No, you are missing the point. I discovered a regression while researching a browser inconsistency. It is not a documentation issue.
If you load this in FF and IE, they will give different results (using jQuery 1.6.3). This is what I was researching.
But, while doing that research, I found IE doesn't give _any_ data (using jQuery edge). This is the bug I am reporting.
Changed September 28, 2011 06:49PM UTC by comment:4
keywords: | needsdocs |
---|---|
owner: | psayre@sitecrafting.com → rwaldron |
status: | new → assigned |
Changed September 28, 2011 06:53PM UTC by comment:5
resolution: | → invalid |
---|---|
status: | assigned → closed |
"data-elem-ID" is an _invalid_ attribute. See: http://www.w3.org/TR/html5/elements.html#embedding-custom-non-visible-data-with-the-data-attributes
A custom data attribute is an attribute in no namespace whose name starts with the string "data-", has at least one character after the hyphen, is XML-compatible, and contains no characters in the range U+0041 to U+005A (LATIN CAPITAL LETTER A to LATIN CAPITAL LETTER Z).
Correct: http://jsfiddle.net/rwaldron/qmLdX/8/embedded/result/ (works in all IEs)
That's correct, see item 5 here:
http://www.learningjquery.com/2011/09/using-jquerys-data-apis
If you access the properties via
.data()
it should still be possible to get them consistently across different versions, only the internal representation has changed so we could be compliant with the way the W3C wants it.What should we add to the documentation at http://api.jquery.com/data/ to clarify the issue? Looks like we don't have an example with a dash, which would probably help.