Skip to main content

Bug Tracker

Side navigation

#10012 closed bug (invalid)

Opened August 10, 2011 01:01PM UTC

Closed August 10, 2011 01:37PM UTC

Last modified August 27, 2011 08:18PM UTC

$.data(this,'foo') != $(this).data('foo') with html5 data attributes

Reported by: anonymous Owned by:
Priority: low Milestone:
Component: data Version: 1.6.2
Keywords: Cc:
Blocked by: Blocking:
Description

$.data(this,'foo') return "undefined" with html5 data attributes

$(this).data('foo') return correct value with html5 data attributes

See it:

http://jsfiddle.net/4LWvB/

Attachments (0)
Change History (4)

Changed August 10, 2011 01:37PM UTC by ajpiano comment:1

resolution: → invalid
status: newclosed

Thanks for taking some time to contribute to the jQuery project, but this is a known, documented, and intended behaviour. From the docs for jQuery.data(elem, key)

"Regarding HTML5 data-* attributes: This low-level method does NOT retrieve the data-* attributes unless the more convenient .data() method has already retrieved them."

Changed August 10, 2011 02:16PM UTC by rwaldron comment:2

component: unfileddata
milestone: None1.6.3
priority: undecidedlow

Changed August 26, 2011 01:46AM UTC by dmethvin comment:3

milestone: 1.6.3

Changed August 27, 2011 08:18PM UTC by dmethvin comment:4

#10111 is a duplicate of this ticket.