Sunday, 15 January 2012

Include Underscore.js with jQuery no-conflict -



Include Underscore.js with jQuery no-conflict -

i need include underscore.js in platform uses prototype.js , has jquery in noconflict mode.

how it? backbone illustration shows can point jquery using backbone.$ = $j.

but underscorejs.org doesn't seem have info around it.

thanks,

you don't need special if have both backbone , jquery (in no-conflict mode or not) on page.

here part of backbone code (as of backbone 0.9.10) backbone.$ assigned:

backbone.$ = root.jquery || root.zepto || root.ender;

what means backbone.$ set utilize "jquery" variable if exists (and should whether you're in noconflict mode or not), , if isn't there seek utilize zepto or ender libraries instead.

source: https://github.com/documentcloud/backbone/blob/21a875b2c50b8a69760b4e6a80495a153e5065b3/backbone.js#l44

if you're asking underscore , jquery, please aware underscore has no dependency on jquery @ -- backbone has dependency on (or 1 of other libraries mentioned).

jquery underscore.js

No comments:

Post a Comment