Live data from Hacker News

jQuery 3.0 Released

jquery.com

151–160 of 164 posts

Re: jQuery 3.0 Released

#151
post #112

Earlier quoted context omitted.

> If you're not handling the error in the first promise, then throw it again. You are handling the error (e.g. providing the user with a flash message telling them their was an error) - but if you don't re-throw it you will end up in the 'success' callback-chain - without a result obviously. Therefore whether you re-throw the error or squash it depends on whether another 'reject' function will be there to squash it f…

> Therefore whether you re-throw the error or squash it depends on whether another 'reject' function will be there to squash it further down the chain etc. Does it matter if another 'reject' function is there to squash it? I was under the impression that unhandled rejections would just vanish into the ether... no need to worry about another promise handling them. Just re-throw the error and forget about it. Edit: To…

> Edit: To be clear, the browser may display an error in the console as a diagnostic tool, but my impression is that unhandled rejections will not result in an actual exception that halts execution.

Well if it's not handled there is simply no further promise-chain to call. If you maintain a large-enough app, you probably have some kind of tool for reporting client-side javascript errors. When you have unhandled promises it's not always clear that they are unhandled because you handled it and just happened to re-throw even though the promise has no further chain, or whether someone messed up and actually isn't handling a rejection. Thus to avoid this, adding new promise to a chain involves finding the first .catch(), adding a throw, and an extra .catch() further down the chain.

Re: jQuery 3.0 Released

#152

Is anybody in the HN crowd still using jQuery for new projects? If yes, why not use "vanilla" js?

Most definitely, yes. I have plenty of projects where there's enough JS interacting with the DOM to use jQuery, but too little to justify adding the entire React package. Furthermore, a number of my projects 1) might have to be taken over someday by developers who don't know React, 2) might eventually have jQuery added anyways for a quick plugin (slideshow, etc.), or 3) have jQuery included already because the client insists on the use of a particular CMS.

Re: jQuery 3.0 Released

#153
post #142
post #53

Earlier quoted context omitted.

Don't get me going on Python in the browser... :)

1) There's certainly not "one way" to iterate in Python[1], and they're not even consistently named (xrange is the iterator version of range, but izip is the iterator version of zip). 2) You can use Python in the browser[2][3][4 sort of]. 1. https://youtu.be/OSGv2VnC0go?t=3m20s 2. http://transcrypt.org 3. http://pyjs.org 4. http://www.rapydscript.com

From "import this"

> There should be one-- and preferably only one --obvious way to do it.

Key words are preferably and obviously. Of course there are going to be multiple ways to do everything, but it'd be nice if the best practice is pretty obvious.

> Although that way may not be obvious at first unless you're Dutch.

Re: jQuery 3.0 Released

#154
post #85
post #30

Whenever a new version of jQuery (or Zepto) comes along, I wonder what would have happened if web development borrowed a page from other ecosystems and browser runtimes had subsumed the jQuery API, shipping it natively. It's a controversial notion, I'll grant, but what if the DOM APIs had been replaced by "native" jQuery support? Would we have been better off? Worse? Considering the intricacies of standards bodies an…

What I wonder is why not have a heavily cached, canonical version of each jQuery library, and every other library as long as it is used on a lot of sites? These days the browsers cache the bytecode, which is almost as fast as shipping native code with the browser. I think google used to host those things. It automatically becomes more cached the more it is used. https://developers.google.com/speed/libraries/ The down…

Actually those CDNs for libraries like jquery don't have as high of a cache hit rate as you'd think.

The problem is that there is a pretty wide number of versions of each library that are used. Combine that with the fact that mobile caches are still laughably small (like 5-50mb on some phones), means that it's not really helping all that many people.

As for the caching stuff, there was a push for that with html imports (basically treating all imports with the same name as the same, so if you and another library needed jquery, they could both use the one in your cache without needing to re-import it), but I haven't heard anything on it for a while, and i'm not sure if that's even a goal any more.

Re: jQuery 3.0 Released

#155
post #85
post #30

Whenever a new version of jQuery (or Zepto) comes along, I wonder what would have happened if web development borrowed a page from other ecosystems and browser runtimes had subsumed the jQuery API, shipping it natively. It's a controversial notion, I'll grant, but what if the DOM APIs had been replaced by "native" jQuery support? Would we have been better off? Worse? Considering the intricacies of standards bodies an…

What I wonder is why not have a heavily cached, canonical version of each jQuery library, and every other library as long as it is used on a lot of sites? These days the browsers cache the bytecode, which is almost as fast as shipping native code with the browser. I think google used to host those things. It automatically becomes more cached the more it is used. https://developers.google.com/speed/libraries/ The down…

[deleted]

Re: jQuery 3.0 Released

#156
post #119

Earlier quoted context omitted.

I'm not advocating for or against jQuery or printf. I'm just pointing out that equating the two (in size, utility, or potential gains by avoiding them) doesn't make a lot of sense. jQuery's ratio of size-versus-additional-utility is much larger than printf's, even more so if you consider typical use cases of each. But it isn't even a fair comparison to begin with. How about comparing jQuery to libc. I'd still argue t…

libc seems much more substantial, maybe we can split the difference and call it "youmightnodneedstdio.com", although that sounds much less pithy. I still wouldn't be so sure about that ratio. The people decrying the printf family of functions are often targeting small statically linked binaries. Where a few kb shaved off might be a bigger chunk than 30kb are for your usual multi-megabyte front page of today's web.

People who target tiny static binaries are by far in the minority of libc users.

Re: jQuery 3.0 Released

#157
post #78
post #73

Earlier quoted context omitted.

Yup. > If yes, why not use "vanilla" js? I can't answer that, but I can answer "Why not use $Framework?" My current project (a large admin system) is crying out for the more complex parts of the admin UI to be built in React, Angular etc. The problem is it's an all-or-nothing situation. When picking up a new technology I want to add a little bit to the current project, a bit more to the next, and so on. Progressive E…

Vue.js is a really great way to add progressive enhancement. Can add it to a single page or even a single element on a page and not effect the rest of the page.

Does Vue.JS cover all the features of React and handlebars and can just be used for small parts of the application?

Re: jQuery 3.0 Released

#158
post #125
post #82

Earlier quoted context omitted.

Why is it all or nothing? We've been replacing certain parts of our vanilla js application with small React apps and it's worked brilliantly. There is a really good talk by Ryan Florence where he replaces backbone components (i think) with React components.

> Why is it all or nothing? Erm, because that's the impression I've got from the tutorials and demos. I guess a "Add $Framework to a bit of your app" isnt' sexy: the ones I've seen add their own routing and focus on SPAs. Rather than "Here's some incredibly complicated information to display, and we need to be fairly interactive over it (and how other data on the page affects it)". Would it work if you didn't have a…

Facebook.com is afaik replacing small more and more small parts with react components

Re: jQuery 3.0 Released

#159
post #126
post #105

Earlier quoted context omitted.

Every framework out there can be used on a small part of an app at a time.

That's grand, the tutorials and examples gave me the opposite impression (SPAs and own-everything)

They always seem to have an example of being used on a small part of the page, but nobody actually tends to do this and there isn't much in the way of blog posts about it.

Re: jQuery 3.0 Released

#160
post #148

Earlier quoted context omitted.

That was submitted yesterday and flagged as a dupe. https://news.ycombinator.com/item?id=11871658

It was a dupe, as is the current post. I explained this at https://news.ycombinator.com/item?id=11872457 . Perhaps we should stop having major discussions when things come out as release candidates, so that we can have the major discussion on actual release? I don't know. Trying to make it work that way might just cause more problems.

I think that makes sense. All rc announcements have the same issue.
Post reply on HN