Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Conversation

wesleycho
Copy link
Contributor

This PR addresses issue #3340, adding support for Zepto as well as jQuery.

This modification will opt for jQuery over Zepto whenever both are present.

Note: This also requires a modification to karma-ng-scenario, which I will submit a PR for to pair with this PR.

Warning: There may be tests/code that I did not write that should be written to account for the differences between jQuery, Zepto, and Angular, so it is possible that this is not complete - all of the current tests pass though, which otherwise break badly.

The documentation would need to be rewritten to note this feature as well.

@jdalton
Copy link
Contributor

jdalton commented Jul 25, 2013

I don't think support should be added. Zepto is not jQuery and has issues like leaking event data because it doesn't cleanup data of removed elements via it's .remove() method. Devs wanting reduced file size and modern browser support should instead opt for a jQuery 2 custom builds.

@petebacondarwin
Copy link
Contributor

I agree with @jdalton. Moreover zepto does not support IE.

@wesleycho
Copy link
Contributor Author

I'm not too familiar with Zepto myself, but from what I understand, Zepto is not meant to be a 100% replacement for jQuery, but a complementary option - right on the homepage for Zepto, it mentions doing a conditional load for IE. It also appears to angle itself more for mobile browsers.

I was not aware of the leaking event data problem though - that is unfortunate, thanks for bringing that to attention. I assume that the Zepto developers are against fixing the problem then? In any case, it would be no big loss if this PR was closed then.

@petebacondarwin
Copy link
Contributor

@wesleycho - Hi - I think that we are not going to provide official support for Zepto. I wonder if you can get around it for your own applications though, by simply loading it up before angular.js and then changing its name to jQuery?

jQuery = Zepto;

Before bootstrapping AngularJS?

@grapswiz
Copy link

grapswiz commented Apr 8, 2014

When I use Zepto to replacing of jQuery, One problem occurs in .data method, so angular's initialization does not completed.

Uncaught InvalidCharacterError: Failed to execute 'setAttribute' on 'Element': 'data-$$ng-animate-state' is not a valid attribute name.

It is because Zepto's .data method only support string property.

@wesleycho
Copy link
Contributor Author

Zepto is not supported as a replacement for jqLite in Angular.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants