gmac / backbone.epoxy

Declarative data binding and computed models for Backbone
http://epoxyjs.org
MIT License
615 stars 89 forks source link

Compatibility with jQuery.noConflict() #60

Closed jbarros closed 10 years ago

jbarros commented 10 years ago

I'm trying to include Backbone.Epoxy in a WordPress plugin, but the jQuery that WordPress ships has noConflict turned on by default. Constructing a view results in a "TypeError: $ is not a function" error.

https://github.com/gmac/backbone.epoxy/blob/8cef8fff1825c59f96a2e1f13fc6b86f71f9a0f0/backbone.epoxy.js#L1055

Changing this line:

var $element = $(this);

to this line:

var $element = self.$(this);

seems to fix the problem.

I started on a pull request, but abandoned it. It looks like the tests are fairly reliant on $ being the jQuery/Zepto instance, and I'm not sure my environment is set up right because the minification build generates a large diff for a tiny change.

Thanks for Backbone.Epoxy. It's just the right amount of opinionatedness and has already saved me a lot of time.

gmac commented 10 years ago

Nice catch, thanks! See 8cef8ff.