-
Notifications
You must be signed in to change notification settings - Fork 264
jQuery.fn.data() and data-* attribute name restrictions #383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What do you mean by "will not work"? It appears to work fine here: http://jsbin.com/IzIKInET/1/edit?html,js,output |
What I mean by "will not work" is "will not work". Yes, you're asking for the property specifically, that's fine, we'll make sure the docs reflect this; in the meantime, take a look at this: http://jsbin.com/aWaWegi/4/edit?html,js,console |
Understood. I was just asking for clarification. It seemed to be "will not work except when it does work" based on my stupid test :) |
Unfortunately, yes. This is a particularly frustrating and hairy bug. @gnarf and I would ultimately like to break backward compatibility in favor of HTML5 data-* compatibility, but no definite answer yet. |
Backward compat is already broken.
Works in 1.9, fails in 2.x. I agree on the sentiment that it should track the dataset spec. |
This will be fixed in 3.0. However, we should document that retrieving data with keys containing numbers after dashes may not return the expected result before jQuery 3.0 and that the dash will not be removed in this case in 3.0+, which will reflect the dataset spec. |
http://bugs.jquery.com/ticket/14376
jQuery.fn.data()
will not work data-* attributes in the very specific case where an attribute has been named with multiple words and any of the words after the first word (not includingdata-
) begin with a digit.Example:
However, these work just fine:
The text was updated successfully, but these errors were encountered: