[ckan-dev] recline model: is the jquery dep necessary?

James Casbon casbon at gmail.com
Fri Mar 30 15:15:17 UTC 2012


On 30 March 2012 16:06, Rufus Pollock <rufus.pollock at okfn.org> wrote:
> On 30 March 2012 15:59, James Casbon <james.casbon at okfn.org> wrote:
>> Just had a go at loading the recline model parts.  Now I want to load
>> them in a non browser js environment (think web worker/node.js), but
>> there seems to be a jquery dependency - which may be unnecessary.   If
>> it is, it would help me to reuse the data code out of the browser if
>> it was dropped.
>>
>> For example, the code in http://okfnlabs.org/recline/src/model.js is
>> wrapped in :
>>
>>  (function($, my) {
>>     ... all the code
>>  }(jQuery, this.recline.Model));
>>
>> Can someone enlighten me as to what this does and whether it needs
>> jquery to do it?
>
> I'm using jquery functionality a lot to find elements
> ($('.xxx).find(...)) and for $.each / $.map (could move all of that to
> underscore).
>
> How are you doing element selection without jquery?

Do you mean DOM element selection? That shouldn't happen in model code, right?

Yes, underscore has each/map/ etc http://documentcloud.github.com/underscore/

Actually I see now you use a jquery deferred in there.




More information about the ckan-dev mailing list