Skip to main content

Bug Tracker

Side navigation

#9270 closed bug (invalid)

Opened May 13, 2011 03:10AM UTC

Closed May 13, 2011 03:59AM UTC

Last modified May 17, 2011 01:35AM UTC

difference between $.data() & .data()

Reported by: swain Owned by: rwaldron
Priority: high Milestone:
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'

Attachments (0)
Change History (3)

Changed May 13, 2011 03:48AM UTC by rwaldron comment:1

component: unfileddata
owner: → rwaldron
priority: undecidedhigh
status: newassigned

Changed May 13, 2011 03:59AM UTC by ajpiano comment:2

resolution: → invalid
status: assignedclosed

I am not inclined to think this is a valid bug.

A) It is clearly documented that when using, "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.

Changed May 17, 2011 01:35AM UTC by swain comment:3

I see, Thank U!