Hacker News new | past | comments | ask | show | jobs | submit login
JQuery 1.9 has been released (jquery.com)
202 points by jonknee on Jan 15, 2013 | hide | past | favorite | 41 comments



For anyone making a shift from 1.7/1.8 to this, please don't overlook the jquery-migrate plugin (https://github.com/jquery/jquery-migrate/).

You/we don't have to suffer the headaches of "what the heck changed since the version I was using...", the jQuery overlords have really done us a great service in offering this cool migration checker - so let's use it!


So, how does one use jquery-migrate? Include the script tag and...

Will it show me which method (in which file) to replace in console?



that's what I got when using jquery migrate http://i.imgur.com/nviTD.png not that helpful, or am I missing something?


* Click on the hyperlink for the line where the message was generated.

* Set a breakpoint.

* Refresh the page.

* View the stack trace(s).

Adding stack traces to the plugin itself would be difficult, since that's not standardized functionality and it would add quite a bit of bulk to the plugin.


Those are warnings to let you know that you are using deprecated functionality. Everything should still work, but you'll want to switch to the updated versions soon.

Instead of $.browser, use $.support, and instead of .live(), use .on().


I get it, but I thought it would map the occurences in my code, not just list the functions.


Ah, gotcha. If you have the console open at the time when the warning is triggered, you should be able to get a backtrace by clicking on the arrow beside the warning -- that will show you whereabouts in the code the problem is.

At least that's how it works in Chrome, I think Firefox does the same.


no arrow in ff (firebug 1.11.1) nor in chromium (firebug lite).


zalew, try out the Chrome dev tools (hit CTRL-SHIFT-I)


Nothing too terribly exciting, but the Source Map feature, allowing easier debugging inside minified code seems very useful. Chrome only, but still an extremely slick feature:

http://www.html5rocks.com/en/tutorials/developertools/source...


> Chrome only, but still an extremely slick feature

Only for now, fortunately! The co-authors are from Google and Mozilla[1], and work's being done to get support in Firefox as well.

[1] https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiO...


iirc, visual studio supports source map debuging too. (at least it does for typescript generated code)


Important for those who haven't heard yet: jQuery 2.0 will not support IE 6, 7 or 8.


I can understand dropping 6 and 7, but 8? That browser's not going away anytime soon.


As I understand it, JQuery 1.9 and 2.0 are supposed to be API identical so what is suggested is to offer JQuery 1.9 to sub-IE9 via conditional comments.


That's one of the ways, but you can just stick to 1.9 for all of your audience if audience includes early IEs.

jQuery 2.0 is more appropriate for mobile web-apps or for intranets, where you know that users use strict subset of browsers


Given that jQuery 2.0 is supposed to be significantly faster, parent's approach offers increased speed to users who are not on sub-IE9 browsers.


Faster how? Do you have any source? Only thing I remember from my brief scan of the release notes was that it was faster to load as it was smaller (fewer browsers to support) but I don't recall anything about processing speed, happy to be proven wrong of course.


>jQuery 2.0 will not run on oldIE. As a result of removing several layers of barnacle-encrusted code, it will be both faster and smaller than jQuery 1.9.

My take here is that various bits of logic have been removed which will also improve processing speed.

Of course, they may have been referring to the load speed, and the increase in processing speed may be negligible.


It's going to have support for al IEs but as an official plugin and not in the main distribution (which is a good thing IMHO)


Do you have a link for that? I've only seen them say "if you need to support IE8, you need to use jQuery 1.9". No mention of a plugin.


IE8 is almost 4 years old. I think in another couple of years market share will easily be under 5%.

Sure, people on XP can't upgrade to another IE, but they can install Chrome, Firefox or Opera. In the corporate world, admins will upgrade to something else when they have to. With a little nudging maybe they'll have to sooner than later.


More importantly, it lacks the 10 years old DOM Level 2 and XHTML features, and DOM Level 2 is probably important for jQuery.


It and IE 9 also lack CORS support.


They are continuing support for both 1.9 (supporting IE6+) and 2.0


I'd be happy if they stopped supporting IE altogether.

Ten versions should be enough for Microsoft to get it right. If they haven't gotten it right by now, it's not going to happen.

Microsoft needs to fix their crap browser, rather than forcing every web dev on the planet to use nasty hacks and workarounds.


> Microsoft needs to fix their crap browser, rather than forcing every web dev on the planet to use nasty hacks and workarounds.

This is not a problem unique to IE. Firefox, Chome, Safari, and others all need shims/patches/etc too:

> But to the point about cross-browser issues, it’s a complete myth that today’s modern browsers have no differences. Look through the jQuery source code and you’ll see plenty of places where it has to fix, patch, and mask issues in modern browsers; those problems didn’t end with IE8. jQuery 2.0 now has more patches and shims for Chrome, Safari, and Firefox than for Internet Explorer!

http://blog.jquery.com/2013/01/14/the-state-of-jquery-2013/

So, how about we stop spreading myths and using vitriolic language, and provide constructive criticism and feedback so Microsoft and others can all fix bugs and issues with their browsers?


Code that I write almost invariably works without change in Chrome, Firefox, Safari, and all the others (including Opera), then I wind up having to do a bunch of hackery to make it work in IE.

I'm talking basic layout and JS functionality, not super-convoluted stuff like jQuery.

Sorry, it's an IE problem.

As for "constructive criticism and feedback": Microsoft has been ignoring it for the last 15 years. What makes you think they're going to start listening now?


In my experience, it's not as terrible when things "break" in Chrome, FF or Safari, as it is when they break in IE.


Can anyone comment on or point me to a resource describing what will break when using jQuery 2.0 in an older IE? I assume pages will still render and most basic jQuery functions will still work, but it would be good to know exactly what the degraded behavior will be.


Everything, including events will break since IE<9 doesn't support addEventListener, thus $(document).ready() will not even run. Basically don't use 2.0 for the web. The only advantage is that it will be smaller, so if you have a mobile specific site, it could be better.


A better recommendation would be 'don't ship JavaScript to oldIE'.

IE 6-8 have terrible JavaScript engines, JavaScript is going to do very little to help you deliver a good experience to users stuck on those browsers. For websites, let these users round-trip to the server for form-submissions, links etc. Progressively enhance with JS for IE9+

If you have commercial customers stuck on oldIE and have to deliver a single-page web app, your answer is Chrome Frame (and yes I've had experience asking customers on corporate networks to install Chrome Frame and had no objections/problems yet, as long as you're up-front with them).


> Basically don't use 2.0 for the web.

That depends entirely on what you're building.


Uhm, if it's not for the web, what's it for? Only for phonegap apps?


Phonegap apps, mobile web, intranet apps when you know that everyone will be using IE9 or Chrome...


I'm going to take a wild guess and say that IE's javascript engine will halt processing any additional code when it hits an error, so if your site relies on it it won't work very well indeed.


I'm happy for the addition of the :target selector. I tried using this on a recent project before realizing it wasn't available.


Be careful if you are using this link as a source:

https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js

A few things in this update broke a production app for us.


How has everyone's experience so far been upgrading? Any speed improvements?


In theory, jQuery 2 should be a lot faster because of removed support for old browsers.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: