#9270 closed bug (invalid)
difference between $.data() & .data()
Reported by: | swain | Owned by: | Rick Waldron |
---|---|---|---|
Priority: | high | Milestone: | 1.next |
Component: | data | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
ex: <div data-attr="test"></div>
$.data('div','attr'); return undefined $('div').data('attr'); return 'test'
Change History (3)
comment:1 Changed 11 years ago by
Component: | unfiled → data |
---|---|
Owner: | set to Rick Waldron |
Priority: | undecided → high |
Status: | new → assigned |
comment:2 Changed 11 years ago by
Resolution: | → invalid |
---|---|
Status: | assigned → closed |
Note: See
TracTickets for help on using
tickets.
I am not inclined to think this is a valid bug.
A) It is clearly documented that when using jQuery.data(elem, "key") signature, it will not automatically parse data-attributes:
"Regarding HTML5 data-* attributes: This low-level method does NOT retrieve the data-* attributes unless the more convenient .data() method has already retrieved them."
B) Your code does not even use that signature, but rather an invalid $.data("string", "string") signature, which would not ever be expected to produce valid results.
If you can produce a working test-case on jsFiddle, we can reopen this bug, but for now, it appears to be invalid.