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

Comments

Projects
None yet
5 participants
@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

This comment has been minimized.

Copy link
Collaborator

Duder-onomy commented Aug 1, 2016

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Contributor

blikblum commented Aug 2, 2016

Why not always use addEventListener?

@jccazeaux

This comment has been minimized.

Copy link
Contributor

jccazeaux commented Aug 3, 2016

See my comment here. Maybe it can help you?

@Namek

This comment has been minimized.

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

This comment has been minimized.

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