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

Incompatible with ender js #646

Closed
carnage opened this issue Jul 30, 2016 · 6 comments
Closed

Incompatible with ender js #646

carnage opened this issue Jul 30, 2016 · 6 comments

Comments

@carnage
Copy link

carnage commented Jul 30, 2016

When used with Ender Js, there is an error on load. It is due to ender registering the $ function which is being detected in https://github.com/mikeric/rivets/blob/master/src/util.coffee

Several options for a fix.

You could prevent the usage of jquery bindings if the ender function is defined

You could use $ to bind the methods instead of jQuery

or You could use (window['jQuery'] || window['$']) to create your methods, matching the if statement.

@Duder-onomy
Copy link
Collaborator

Yeah, you are totally right. I just read through the 'ender.js' docs and it seems there is no way to release control of the $. Considering jQuery has been around for 10 years ish, and 'ender.js' for less, seems like ender should have accounted for the $ being in such high demand. Have you also opened up an issue on 'ender.js' so that they will make their shorthand lib reference something that does not conflict with jQuery?

Rivets was written in 2012, and I am sure that at the time, the $ was probably only in demand from jQuery, at that time there would have been little reason to assume some other library wanted to use it.

Anyways, you are correct that there should be a way to opt out of this auto detect jQuery behavior as other libs will eventually want control of the $ as well.

If we were able to make this jQuery or no jQuery business a little better I think we could also resolve this issue: #641

I think some of the other core members should comment here and gauge interest.

@carnage
Copy link
Author

carnage commented Aug 2, 2016

Ender.js is intended to be a lightweight jQuery replacement; the code in rivets works fine if it uses the $ function provided by ender, the issue is it looks for $ || jQuery then uses jQuery

@blikblum
Copy link
Contributor

blikblum commented Aug 2, 2016

Why not always use addEventListener?

@jccazeaux
Copy link
Contributor

jccazeaux commented Aug 3, 2016

See my comment here. Maybe it can help you?

@Namek
Copy link
Contributor

Namek commented Sep 13, 2016

I use http://minifiedjs.com/ and sometimes (rarely) rivets can't initialize because jQuery is undefined. Of course minifiedjs also initializes global $ because it's meant to replace jQuery lib.

As @carnage explained it checks for $ OR jQuery and then always try to use jQuery. I made PR for it (linked above).

@Namek
Copy link
Contributor

Namek commented Sep 20, 2016

@Duder-onomy wouldn't it make sense to merge #679 until next decisions about jQuery are made?

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

No branches or pull requests

5 participants