Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#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:


ex: <div data-attr="test"></div>

$.data('div','attr'); return undefined $('div').data('attr'); return 'test'

Change History (3)

comment:1 Changed 12 years ago by Rick Waldron

Component: unfileddata
Owner: set to Rick Waldron
Priority: undecidedhigh
Status: newassigned

comment:2 Changed 12 years ago by ajpiano

Resolution: invalid
Status: assignedclosed

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.

comment:3 Changed 12 years ago by swain

I see, Thank U!

Note: See TracTickets for help on using tickets.