Skip to main content

Bug Tracker

Side navigation

#13778 closed bug (notabug)

Opened April 15, 2013 02:17PM UTC

Closed April 15, 2013 04:26PM UTC

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.

Attachments (0)
Change History (1)

Changed April 15, 2013 04:26PM UTC by dmethvin comment:1

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