News for hackers. Stuff that matters.
Re:Going Simple with JavaScript by XLcommerce on Monday March 05, 2012 @09:59AM (#3666678)
I've recently thought about going 'Naked' JS, but I'm dubious about the benefits.

I haven't dug into the code, but doesn't jQuery already use native methods like querySelectorAll where available?

I guess if all you need is to query the document and you know your target audience is running a modern browser... then sure, save yourself 31k :)

Re:Going Simple with JavaScript by masklinn on Monday March 05, 2012 @12:53PM (#3667447)
> I haven't dug into the code, but doesn't jQuery already use native methods like querySelectorAll where available?

Yes. But it still has quite a bit of overhead as it also handles non-standard selectors (implemented in javascript), things like :input.

> I guess if all you need is to query the document and you know your target audience is running a modern browser... then sure, save yourself 31k :)

If you've got an ever more restricted target audience, you can also use things like Zepto (webkit-only, jQuery's interface in 7k)

Re:Going Simple with JavaScript by untog on Monday March 05, 2012 @11:33AM (#3667064)
That's why I like the idea (if not necessarily the implementation) of things like zepto.js. Keep the jQuery syntax. Use the tiny, optimised library when you can. Use jQuery when you can't.
Re:Going Simple with JavaScript by joesixpack2 on Thursday March 08, 2012 @01:38AM (#3678831)
Except you have no reliable to way to know when you can and when you can't (and no good way to swap between libraries). Best you can do is conditional comments to target old IE versions and you sure don't want jQuery on that team.
Re:Going Simple with JavaScript by c_t_montgomery on Monday March 05, 2012 @10:59AM (#3666916)
Yes, jQuery does utilize things like querySelectorAll (among other things) when available.
Re:Going Simple with JavaScript by joesixpack2 on Thursday March 08, 2012 @01:36AM (#3678829)
Not exactly correct. It uses QSA only under certain conditions. Unfortunately, the fallback code is not compatible with QSA (and not consistent across their "supported" browsers).