Bug Tracker

Modify

Ticket #7332 (closed bug: duplicate)

Opened 3 years ago

Last modified 3 years ago

.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:
Blocking: Blocked by:

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.

Change History

comment:1 Changed 3 years ago by john

  • Status changed from new to closed
  • Resolution set to duplicate

comment:2 Changed 3 years ago by john

Duplicate of #7222.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.