Live data from Hacker News

Bling – the $ of jQuery without the jQuery

gist.github.com

111–120 of 138 posts

Re: Bling – the $ of jQuery without the jQuery

#111
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)

Um, isn't the point of Zepto a modular jQuery that may not support 100% of what jQuery does but it tries to at about the same speed (or better)?

I think modern jQuery is already modular (or semi-modular) and you can download a build of it that contains the features you want.

But honestly, if you load jQuery from a big-time CDN, chances are your users already have it cached and don't need to load anything.

Re: Bling – the $ of jQuery without the jQuery

#112
post #62

Earlier quoted context omitted.

Alternatively: console.log("woof") void function() { console.log("foo") }() There really is only one ASI rule you need to remember [0] in practice: don't begin a new line with ( or [ if it's intended to be a new statement. On this topic, it could so easily have been different; I found this interesting from Brendan Eich [1]: > I wish I had made newlines more significant in JS back in those ten days in May, 1995. Then…

> There really is only one ASI rule you need to remember [0] in practice: don't begin a new line with ( or [ if it's intended to be a new statement. Here's an even easier and clearer one: finish every statement with a semicolon.

  function hello() {
    var x = 0;
    return
    {
      x: x,
      y: y
    };
  };
Just putting semicolons where you think it can work won't help you. If you write javascript, you must know what the asi does. So semicolons or no semicolons is completely irrelevant.

Re: Bling – the $ of jQuery without the jQuery

#113
My worry about using this is you'd better be damn sure you never actually use jQuery or libraries that integrate with jQuery if you're going to use it. I think this is a cool demonstration of the difference between some of the "convenience" functions of jQuery many are familiar with and the MEAT of jQuery which is the functionality and cross-browser issue smoothing.

Re: Bling – the $ of jQuery without the jQuery

#115
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.

I'm using standard [1] for style. I love semicolons too, but am giving it a go without them here. TBH, it feels kinda weird, and I'll probably end up on semi-standard [2] in the end.

[1] https://github.com/feross/standard [2] https://github.com/Flet/semistandard

Re: Bling – the $ of jQuery without the jQuery

#117

Earlier quoted context omitted.

> I'm all for eliminating unnecessary bloat, but it's not as if a jQuery download is a huge amount of data to fetch. While jQuery is not a framework, most front-end JS frameworks are the same size or bigger and don't receive as much attention for being bloated. Remember size isn't as much of an issue when it's less than 100kb (though 3G or less networks that will still be painful). The biggest issue is yet another fi…

> The biggest issue is yet another file for the browser to fetch. There's no reason you can't concatenate jQuery with the rest of your JS.

> There's no reason you can't concatenate jQuery with the rest of your JS.

True and most applications should really do this. In reality I've seen far too many production system still including sometimes over 50+ files.

Re: Bling – the $ of jQuery without the jQuery

#118

Earlier quoted context omitted.

> Bad programmers that can't understand ASI will be also confused by the floating point semantics, promises and other basic concepts — there are many ways of "making your code do something you did not intend" in JS, but that's no excuse for bashing language features. This is a terrible attitude. There is no reason you may not understand every case in which a semi colon is automatically inserted but can still understa…

It's the same reason that, yes, you can put "var x" in an if-block, but it's bad practice because it misleads the reader (even one who knows that Javascript is function scoped) into thinking that x is block-scoped.

I'm almost embarrassed to say it took me way to long to realize JavaScript wasn't block scoped.

Re: Bling – the $ of jQuery without the jQuery

#120

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…

> If you don't use all the features, nowadays you can just create a custom build with the stuff you want.

Yes, that's precisely the author's point, except that you might not even need to make custom jQuery builds. You might be able to just use these few lines.

> But these kind of posts seem like mockery on the developers of a library that has provided extreme value for thousands for developers over many years.

There is absolutely no implication of mockery, and anyone who knows anything about Paul Irish knows how laughable that accusation is.

Post reply on HN