Skip to content
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

jQuery < 1.4.3 compatibility #37

Closed
wants to merge 1 commit into from
Closed

Conversation

swiftyone
Copy link

Before 1.4.3 data() did not include HTML5 data-* attributes.
Tested with jQuery 1.4.2

Before 1.4.3 data() did not include HTML5 data-* attributes.
Tested with jQuery 1.4.2
@tuupola
Copy link
Owner

tuupola commented May 30, 2012

1.4.2 is over two years old. Are there still some legacy systems which force using old jQuery?

@swiftyone
Copy link
Author

Not sure.
I'm currently working on a project that started in 2010 and have to use 1.4.2 for compatibility reasons..
But still, using attr() is significantly faster than data(): (http://jsperf.com/jq-attr-vs-data) and the use of attr() is sufficient in this case, as the additional features (as parsing) are not needed.

@TMcKinley
Copy link

I did this change as well before I saw this Pull Request. Good to know that I'm not crazy. :-/

@gillyb
Copy link

gillyb commented Jan 10, 2013

I would also like to see this change, since i am using this plugin, and the system im working on uses jquery 1.4 on some pages, and some pages has the new jquery. (I know it sounds crazy, but it still exists)

@swiftyone - What i don't understand though, is why you kept both implementations in your code commit. If you're using the one you added (using the attr method) then you don't need to check if data exists, since it will work on all jquery versions.

Hence, the code should look like this :
.attr("src", $self.attr('data-' + settings.data_attribute));

btw - I made this change locally, and it works on both the jquery versions we're using. No reason it wouldn't work on all versions.

@swiftyone
Copy link
Author

@gillyb Yeah, it sure works without the old implementation. But if you keep it, you can also use data which you added via .data() yourself, as those changes are not updated on the DOM node. I just like to keep it, even though I probably will never use it...

@tuupola
Copy link
Owner

tuupola commented Oct 24, 2013

Related to #101

@tuupola
Copy link
Owner

tuupola commented Nov 16, 2013

Modified merged in 1.9.x.

@tuupola tuupola closed this Nov 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants