Side navigation
#7332 closed bug (duplicate)
Opened October 27, 2010 06:47PM UTC
Closed October 27, 2010 06:54PM UTC
Last modified October 27, 2010 06:54PM UTC
.data() without args doesn't work with HTML data- attributes
Reported by: | kcivey | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.5 |
Component: | unfiled | Version: | 1.4.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Now that HTML5 data- attributes are in the core, those values should be included in the object returned by $('#id').data(). Currently the HTML5 data handling is only in the part of .data() that deals with a passed key. So you can use, for example, $('#id').data('test') to retrieve the value of the "data-test" attribute, but if you try $('#id').data(), with no argument, you'll get an empty object (assuming you haven't set metadata by other means) rather than an object with a "test" property in it.