Hacker Newsnew | comments | show | ask | jobs | submit login

It would also be nice if the documentation mentioned that it requires jQuery.



Hmm, what does jQuery provide that is so essential that someone decides to add a dependency this big for something so simple? It seems that everything requires jQuery these days, even when a 5-line for loop would do.

-----


> It seems that everything requires jQuery these days

And there's your answer: The "cost" of depending on jQuery is small since so many things depend on it that most potential users probably already pull it in.

-----


That's true, I guess. I just don't think you should include large dependencies if you can easily avoid them.

-----


It really doesn't matter, if you use a version of jQuery that is likely to already be cached (like the ones hosted at Google Code).

-----


JavaScript is an extremely bare language that largely lacks a standard library. Libraries like jQuery make code easier to write and easier to maintain and sometimes even result in smaller downloads for the user.

Ii your website uses the Google CDN to download jQuery new visitors will often not even download jQuery when arriving at your website because their browser probably has it already cached from visiting one of the dozens of other websites they have visited.

-----


It seems to use it for events, selectors, and data attributes.

Some uses are unnecessary, eg. using `closest` to get the container form element. `element.form` can be used on any form input or control to access the form itself.

I dunno though. I don't like adding jQuery as a dependency but there are still some cases where it's just pragmatic, especially with handling events.

-----


Ideally this would be solved in a similar way as when you statically link to libraries in C - the parts of your dependency are pulled in and users don't have to worry about it. (There are other issues with this of course, but they are well understood by now that someone could develop a system to mitigate that by now)

-----


The problem is more about the download size than the actual deployment (unless you mean using only the parts of jQuery you need, in which case I guess it would be hard to share between apps).

-----


You're better off using the full jQuery hosted at a common CDN, since it is likely to already be cached on the user's computer.

-----


This seems to be the new 'cool'. Why jQuery whine, whine, whine. You've got jQuery on your own site. Why are you moaning about it?

The source is here:

https://github.com/guillaumepotier/Garlic.js/blob/master/gar...

The code is pretty much idiomatic jQuery js following most of their style rules, layout rules and standard constructs so it's obviously been written as a jQuery extension. He must know jQuery well, hence why not use it?

As for why, well I spotted a bit of sizzle, jQuery.data and the event framework in one pass of a small code base. Given the nature of the library I can even guess what they're all for without reading the code.

Quite a lot more than the inevitable each that is also in there.

-----


> This seems to be the new 'cool'. Why jQuery whine, whine, whine.

This seems to be the new 'cool'. "Why jQuery whine", whine, whine.

> You've got jQuery on your own site. Why are you moaning about it?

It was a theme requirement, also, Tu Quoque.

> He must know jQuery well, hence why not use it?

Because dependency for 200 lines of code.

> Quite a lot more than the inevitable each that is also in there.

Then the rest of your reply was redundant, wasn't it...

-----


> You've got jQuery on your own site. Why are you moaning about it?

May be he does not. May be He uses Dojo, Prototype or any other JS library.

At least jQuery doesn't extends Object and Array like other libraries so it's quite safe to have as an extra dependency.

-----


right!

-----




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: