Live data from Hacker News

Bling – the $ of jQuery without the jQuery

gist.github.com

41–50 of 138 posts

Re: Bling – the $ of jQuery without the jQuery

#41
post #28
post #18

Can someone explain the new trend to not use jQuery?

A lot of developers originally used jQuery as a cross-browser compatibility library when that was still a major concern. Along the way, jQuery has added tons of extra helper functions and wrappers (ie, .ajax(), .post(), event binding helpers, etc). This has been amazing for web development, but it's also been such a major pillar of web development that a lot of front end developers don't actually know what's happenin…

The "back to their roots" thing inspired this useful reference website: http://standardjavascript.info

Re: Bling – the $ of jQuery without the jQuery

#42
post #6

Tries to play it cool by wrecking jQuery? Check. No semicolons? Check. Put together by Paul Irish? Check. Yep, this submission is Hipster 1.0 Certified.

1) Paul Irish is a former jQuery team member and he has blog entries about how much he's learned from reading jQuery's source code, not sure exactly how he's "wrecking jQuery". 2) Semicolons are still in debate amongst the JS community, I don't think there's a consensus on whether they're needed or not and it seems to boil down to personal preferences. 3) This reeks of ad hominem, how exactly is Paul Irish "hipster"?…

Actually semicolons are necessary. For example, try writing a rather simple script wrapped and stored in a Chrome bookmarklet without inserting semicolons and see your 100% working script crumbles under the weight of all those unexpected exceptions.

Re: Bling – the $ of jQuery without the jQuery

#45
post #29

Yes, you can re-implement jQuery in 10 lines of code... if you only support 0.1% of the functionality of jQuery. jQuery was a game changer for web client side development. Thousands of work hours have been spent on it. It had a specially important role of dealing with all the inconsistencies between browsers. If you don't use all the features, nowadays you can just create a custom build with the stuff you want. If yo…

You are arguing against a strawman - no one is claiming otherwise. All paul_irish wanted to show is that people often use jQuery without realizing that most of what they do is also possible with the current browser APIs. jQuery does a ton more (animation, ajax etc) - the point was not to "rewrite jQuery in 10 lines" (that's Zepto)

Zepto is more of a "provide the jquery interface you're used to" (and that people often find easier, probably by habit) for modern browsers without all the added compatibility in jquery. I don't like the way they present themselves (or at least did in the early days) but I believe they have a place.

Re: Bling – the $ of jQuery without the jQuery

#46
post #6

Tries to play it cool by wrecking jQuery? Check. No semicolons? Check. Put together by Paul Irish? Check. Yep, this submission is Hipster 1.0 Certified.

1) Paul Irish is a former jQuery team member and he has blog entries about how much he's learned from reading jQuery's source code, not sure exactly how he's "wrecking jQuery". 2) Semicolons are still in debate amongst the JS community, I don't think there's a consensus on whether they're needed or not and it seems to boil down to personal preferences. 3) This reeks of ad hominem, how exactly is Paul Irish "hipster"?…

>> Tries to play it cool by wrecking jQuery?

> not sure exactly how he's "wrecking jQuery"

The grandparent is misguided, but I believe they mean using '$' as the QSA. The grandparent probably uses script tags and globals in which case there would be a conflict if a script tag library requires window.$.

JS modules should var $ = require('jquery') (or equivalent) and then use the $ in their local scope if they need jquery.

Re: Bling – the $ of jQuery without the jQuery

#47
Let’s replace non-standard JavaScript syntax-sugar with more non-standard JavaScript syntax-sugar. Except we don’t like that the first non-standard thing is so terse so let’s improve it with a more verbose notation. We don’t want it to be too verbose though, so let’s drop the semicolons.

This is definitely progress. I’m quite convinced that the users of our applications will feel the difference, and they’ll love us for it.

Wow.

Re: Bling – the $ of jQuery without the jQuery

#48

Yes, you can re-implement jQuery in 10 lines of code... if you only support 0.1% of the functionality of jQuery. jQuery was a game changer for web client side development. Thousands of work hours have been spent on it. It had a specially important role of dealing with all the inconsistencies between browsers. If you don't use all the features, nowadays you can just create a custom build with the stuff you want. If yo…

For what it's worth I agree with you; in the end for better or worse jquery is a very good default in that it contains tonnes of debugged code that is tested by literally millions of people in production. It should probably be broken up further but I think they are doing that.

Whenever I've decided I know best and used Zepto or something else it introduces weird bugs and then someone decides we need to support IE8 because their Dad still uses it...

Re: Bling – the $ of jQuery without the jQuery

#49
post #46

Earlier quoted context omitted.

1) Paul Irish is a former jQuery team member and he has blog entries about how much he's learned from reading jQuery's source code, not sure exactly how he's "wrecking jQuery". 2) Semicolons are still in debate amongst the JS community, I don't think there's a consensus on whether they're needed or not and it seems to boil down to personal preferences. 3) This reeks of ad hominem, how exactly is Paul Irish "hipster"?…

>> Tries to play it cool by wrecking jQuery? > not sure exactly how he's "wrecking jQuery" The grandparent is misguided, but I believe they mean using '$' as the QSA. The grandparent probably uses script tags and globals in which case there would be a conflict if a script tag library requires window.$. JS modules should var $ = require('jquery') (or equivalent) and then use the $ in their local scope if they need jqu…

What modules? You mean CommonJS or was it AMD or ECMAScript 6? Still a straw man IMHO :-)

Re: Bling – the $ of jQuery without the jQuery

#50
post #45
post #29

Earlier quoted context omitted.

You are arguing against a strawman - no one is claiming otherwise. All paul_irish wanted to show is that people often use jQuery without realizing that most of what they do is also possible with the current browser APIs. jQuery does a ton more (animation, ajax etc) - the point was not to "rewrite jQuery in 10 lines" (that's Zepto)

Zepto is more of a "provide the jquery interface you're used to" (and that people often find easier, probably by habit) for modern browsers without all the added compatibility in jquery. I don't like the way they present themselves (or at least did in the early days) but I believe they have a place.

I tried "Flot" charts library with zepto as a smaller replacement for JQuery, but it was incompatible with JQuery and uses a weird code style that is incompatible/slow with Firefox (and Zepto devs refuse to fix their code). In the end I replaced the few Jquery dependencies in Flot by hand. It's a shame that Flot still requires Jquery, it's a good charts library.

The primary problem is that the zepto.Z function overrides dom.__proto__, which prevents many JIT optimizations. Overriding an object's __proto__ property is strongly discouraged and will be deprecated in ES6 --Firefox bug 947048

Post reply on HN