Pergunta

I'm using jQuery and underscore.js for my personal project and I love both frameworks. The problem is that they heavily overlap at functionality.

For example there are $.each and _.each, $.extend and _.extend, $.isArray and _.isArray and so on. It doesn't really make sense to have all of those methods twice so I'm looking for a jQuery version without those methods.

Is there any jQuery build available for this?

I rather want those methods at the underscore object than the jQuery object due semantics, (jQuery for DOM, AJAX etc. and Underscore for helper functions), but I would also be very happy with an optimized underscore.js version!

Foi útil?

Solução

jQuery uses those methods all over the place inside its own code. (sometimes with special undocumented behaviors)
You won't be able to remove them easily.

Don't worry about it; the code duplication isn't so bad, and it's much better than maintaining a custom version of jQuery.

Outras dicas

You might have some luck trying out JQuip. The project's goal is to develop a smaller, more modular jQuery. Check out their library builder where you can pick and choose what you need and leave out what you don't.

I'm not sure about your project needs, but it sounds like you're supplementing underscore.js with jQuery. jQuip might help by reducing the bloat you otherwise wouldn't need from jQuery.

Good luck!

I wouldn't worry about the code overlap, especially if you utlize google jquery hosting, your visitor/user might already have it cached and it will not matter much in the grand scheme of it all.

I can't see a point of keeping a library up to date to reduce overlap of this nature.

You can consider using http://sizzlejs.com/, which is JQuery's selector engine. You're not gonna get all of the DOM manipulation stuff, nor AJAX.

Also, I haven't personally tried it; but EnderJS looks promising.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top