Bug Tracker

Opened 7 years ago

Closed 7 years ago

#13778 closed bug (notabug)

inconsistent result from $.data

Reported by: anonymous Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:

Description

Please see the example here: http://jsfiddle.net/k8hBY/4/

If there is a data attribute with a number in the name like (data-test-1 or data-test-1-test) that attribute value will not be returned by $(el).data()

However if you call $(el).data('test-1') before calling $(el).data() the result is correct.

Change History (1)

comment:1 Changed 7 years ago by dmethvin

Resolution: notabug
Status: newclosed

Use the W3C-standard camelCase naming if you want to retrieve directly from the object returned from .data(). http://api.jquery.com/data/#data-html5

Note: See TracTickets for help on using tickets.