Issue with --data-ajax--url and jquery 1.11.2 #2969

Closed
loic opened this Issue Jan 26, 2015 · 6 comments

Projects

None yet

4 participants

@loic
Contributor
loic commented Jan 26, 2015

--data-ajax--url is ignored while the deprecated --data-ajax-url work.

http://jsbin.com/wotamodeco/1 demonstrates the issue.

@kevin-brown kevin-brown added this to the 4.0 milestone Jan 28, 2015
@kevin-brown kevin-brown added the bug label Jan 28, 2015
@kevin-brown
Member

Just following up on this some more based on conversations on IRC.

This appears to be a difference in how jQuery 1.x and 2.x parse the data attributes. I've created two jsbins that clearly reproduce the differences.

1.x: http://jsbin.com/zudohezome/1/edit?html,js,output
2.x: http://jsbin.com/zudohezome/2/edit?html,js,output

This is definitely a jQuery bug, as the HTML5 dataset attribute requires that the second dash is left. Here is a jsbin that confirms it: http://jsbin.com/ruratofulu/1/edit?html,js,output

@kevin-brown kevin-brown added a commit that referenced this issue Feb 10, 2015
@kevin-brown kevin-brown Add jQuery 1.x data attribute note
This adds a note about how nested data attributes do not work in
jQuery 1.x due to a bug with the `$.fn.data` method.

This is for #2969.
caeb0ec
@kevin-brown
Member

I added a note to the documentation about this in caeb0ec, but unfortunately it does not look like the fix will be released for jQuery any time soon. As there is not much that we can do, aside from preferring dataset when possible, I'm going to close this off once I implement the dataset check.

That will still mean that it still won't work in older browsers (IE 10 and below), but there isn't much that we can do about it.

@kevin-brown kevin-brown added a commit that closed this issue Feb 24, 2015
@kevin-brown kevin-brown Added `.dataset` fallback for jQuery 1.x
As we have established already, jQuery 1.x does not correctly handle
`data-*` attributes where there are multiple dashes.  This makes it
so we can still handle nested options when working with jQuery 1.x
by using the `.dataset` option that is supported by all major
browsers as well as IE 11+.

Browser support tables for the `.dataset` attributes can be found at
http://caniuse.com/dataset

A notice was already added to the documentation about this in
caeb0ec.

The related ticket in the jQuery repository about this issue is
jquery/jquery#2070.

This closes #2969.
a9f6d64
@kevin-brown kevin-brown removed the bug label Feb 24, 2015
@304NotModified

I think there should be a workaround for this (with attributes). Or is it there already?

@onokazu
onokazu commented Aug 2, 2015

The documentation still says that this is not supported with jQuery 1.x, or has this been resolved with the recent changes in jquery?

@kevin-brown
Member

This is still an issue with jQuery 1.x and was not fixed in the recent 1.11.3 release.

http://jsbin.com/midenufoqa/1/edit?html,js,output

It is still fixed in the jQuery 2.x line and upcoming 3.x line.

@304NotModified

Can't we have an alternative syntax to get it working with jquery 1.x?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment