About Dave Methvin

CTO, PC Pitstop http://pcpitstop.com

jQuery Migrate 1.2.0 Released

Posted on by

The latest version 1.2 of the jQuery Migrate plugin is here! It can be used with either jQuery 1.9 or jQuery 2.0 to provide diagnostics and remedial help for plugins that haven’t been updated since jQuery 1.9 was released earlier this year. Believe me, this plugin can really make your life easier; if you’ve been afraid of upgrading jQuery, this plugin can cure that irrational software phobia.

The major change in this version is that we’ve re-closed a cross-site-scripting (XSS) hole that was fixed in jQuery 1.7 and reintroduced by the plugin. Essentially, any use of $("#... <tag>") will now always be interpreted as a selector and not as HTML. This is due to some developers using $(window.location.hash) and not realizing that an attacker can often control the contents of the hash on the URL to run code. Always assume that any data you get from an external source may contain harmful content!

You can find this latest version of the jQuery Migrate plugin on jQuery’s CDN:

Using the plugin is as easy as including it right after the version of jQuery you are using, for example:

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.0.js"></script>

Complete instructions and a complete list of the diagnostics given by the plugin are located in the plugin project’s README file.

A full list of all changes are in the issue tracker. Many thanks to Igor Kalashnikov and Max Riviero for their help on this plugin!

jQuery 2.0 Released

Posted on by

You asked for it, you got it: jQuery 2.0 has arrived!

As promised, this version leaves behind the older Internet Explorer 6, 7, and 8 browsers. In return it is smaller, faster, and can be used in JavaScript environments where the code needed for old-IE compatibility often causes problems of its own. But don’t worry, the jQuery team still supports the 1.x branch which does run on IE 6/7/8. You can (and should) continue to use jQuery 1.9 (and the upcoming 1.10) on web sites that need to accommodate older browsers.

Where to Get It

The final jQuery 2.0.0 files can be found here on the jQuery CDN:

The files should also be available on the Google and Microsoft CDNs soon, but please give these folks a few days before releasing a storm of impatient tweets. Also remember that production web sites should be requesting a specific version from any CDN; using a non-specific version like /2/ or jquery-latest.js is considered harmful to your web site’s health and performance.

If you’re upgrading from a version before 1.9, we recommend that you use the jQuery Migrate plugin and read the jQuery 1.9 Upgrade Guide, since there have been a lot of changes. It’s easy to use the plugin, just include it in your HTML file after jQuery and open your browser console to see the messages it generates:

<script src="http://code.jquery.com/jquery-2.0.0.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.1.js"></script>

How to Use It

jQuery 2.0 is intended for the modern web; we’ve got jQuery 1.x to handle older browsers and fully expect to support it for several more years. If you want, you can serve 2.0 to newer browsers and 1.9 to older ones using our conditional comment trick, but that is not required. The simplest way to support older browsers is to use jQuery 1.x on your site, since it works for all browsers.

With the release of jQuery 2.0, there are a few environments where the jQuery team will no longer support use of the 1.x line because 2.x is a far better choice. These are typically non-web-site scenarios where support for older IE isn’t relevant. They include:

  • Google Chrome add-ons
  • Mozilla XUL apps and Firefox extensions
  • Firefox OS apps
  • Chrome OS apps
  • Windows 8 Store (“Modern/Metro UI”) apps
  • BlackBerry 10 WebWorks apps
  • PhoneGap/Cordova apps
  • Apple UIWebView class
  • Microsoft WebBrowser control
  • node.js (combined with jsdom or similar)

Many of these environments are themselves a work in progress, and have unique sets of rules or restrictions that are different from the ones typically found when jQuery is used for browsers on Internet web sites. Although we aren’t able to test regularly in all of these non-browser scenarios, we’d like to hear about your experiences in using jQuery with them. Even better, we’d love for the communities supporting these environments to pool and share their knowledge about how to use jQuery 2.0 there.

How 2.0 Changed

Here are some highlights of the changes that jQuery 2.0 brings:

No more support for IE 6/7/8: Remember that this can also affect IE9 and even IE10 if they are used in their “Compatibility View” modes that emulate older versions. To prevent these newer IE versions from slipping back into prehistoric modes, we suggest you always use an X-UA-Compatible tag or HTTP header. If you can use the HTTP header it is slightly better for performance because it avoids a potential browser parser restart.

Reduced size: The final 2.0.0 file is 12 percent smaller than the 1.9.1 file, thanks to the elimination of patches that were only needed for IE 6, 7, and 8. We had hoped to remove even more code and increase performance, but older Android/WebKit 2.x browsers are now the weakest link. We’re carefully watching Android 2.x market share to determine when we can cross it off the support list, and don’t expect it to take very long.

Custom builds for even smaller files: This feature has been greatly refined and extended since its debut in jQuery 1.8. You can now exclude combinations of 12 different modules to create a custom version that is even smaller. A new minimal selector engine, basically a thin wrapper around the browser’s querySelectorAll API, lets you shrink the build to less than 10KB when minified and gzipped. See the README for instructions on how to create a custom build, and remember that any plugins you use will also need to stick to the subset you select.

jQuery 1.9 API equivalence: jQuery 2.0 is API-compatible with 1.9, which means that all of the changes documented in the jQuery 1.9 Upgrade Guide have been applied to jQuery 2.0 as well. If you haven’t yet upgraded to jQuery 1.9, you may want to try that first. Be sure to use the jQuery Migrate plugin.

The full record of changes can be found in the changelog below, and in the list of commits on GitHub.

What’s Next

In keeping with our pledge to minimize API divergence between the 1.x and 2.x branches, we’ll be releasing a jQuery 1.10 within a couple of months that incorporates the bug fixes and differences reported from both the 1.9 and 2.0 beta cycles. In the future, we will be maintaining feature parity between 1.10 and 2.0, 1.11 and 2.1, etc. Patch releases will happen in each branch on their own schedule, based on team resources and severity of any reported bugs.

Please do try this new release with all your web sites and HTML apps. If you find problems, create a minimal test case (preferably using a site like jsFiddle or jsbin) and submit it to our bug tracker. We’re particularly interested in situations where jQuery 1.9.1 behaves differently than jQuery 2.0.0, since that’s something we’ve tried to avoid.

Who Helped

jQuery 2.0 has been 10 months in the making, a product of the jQuery Core team: Julian Aubourg, Corey Frang, Oleg Gaidarenko, Richard Gibson, Michal Golebiowski, Mike Sherov, Rick Waldron, and Timmy Willison. Oleg and Michal joined the team during the 2.0 odyssey; we’re glad to have them aboard.

Many thanks to the other jQuery team and community members who contributed fixes: Steven Benner, Pascal Borreli, Jean Boussier, James Burke, Adam Coulombe, Tom Fuertes, Scott González, Dmitry Gusev, Daniel Herman, Nguyen Phuc Lam, Andrew Plummer, Mark Raddatz, Jonathan Sampson, Renato Oliveira dos Santos, Ryunosuke Sato, Isaac Schlueter, Karl Sieburg, Danil Somsikov, Timo Tijhof, and Li Xudong.

To those of you who tested the betas and reported bugs, we’re especially thankful for your help since it helped to make the release more solid and stable.

How You Can Help

Please, participate! Try the code (especially the betas), file good bug reports with clear test cases, contribute patches. Write or edit documentation. Come to the jQuery Conference Portland in June and mingle with other jQuery-ites. Visit contribute.jquery.org to learn how to get involved with the project.

You can also become a jQuery Foundation member to support our efforts and get some fabulous gifts in the process!

jQuery 2.0.0 Changelog

Ajax

Attributes

Build

Core

Css

Deferred

Effects

Event

Manipulation

Selector

Support

Traversing

Please do not report bugs in the blog comments! Instead, read the blog post for details on how to report bugs.

jQuery 2.0 Beta 3 Released

Posted on by

We’re coming down the home stretch for the release of jQuery 2.0! Today sees the release of Beta 3.

To paraphrase Dirty Harry: I know what you’re thinking. “Is Beta 3 gonna break my code?” Well, to tell you the truth, in all this excitement we may have lost track of things and introduced some bugs. So being as this is jQuery, the most powerful JavaScript library in the world, and could blow your web site clean off the Internets, you’ve got to ask yourself one question: “Do I feel lucky?” Well, do ya?

We don’t want to accidentally blow your site off the Internets; don’t count on being lucky. That means we really need your help in finding and fixing any bugs that may be hiding in the nooks and crannies of jQuery 2.0. We want to get all the problems ironed out before this version ships, and the only way to do that is to find out whether it runs with your code.

You can get this latest beta from the jQuery CDN: http://code.jquery.com/jquery-2.0.0-beta3.js

You can also use the jQuery Migrate plugin with jQuery 2.0 to restore deprecated features from those older versions and/or diagnose compatibility issues. We strongly recommend that you do use Migrate for older code, it will save a lot of time and trouble in debugging.

Staying in Sync

Remember that jQuery 2.0 will not run on IE 6, 7, or 8. You must run Internet Explorer 9 or 10 in their “modern” mode and not use the X-UA-Compatible feature, for example, to force IE10 into IE7 mode.

The jQuery team will continue to support both the jQuery 1.x and 2.x lines simultaneously for as long as those older versions of IE are still a factor. The currently released version of jQuery 1.x, which is 1.9.1, has the same API as jQuery 2.0. We are planning a 1.10 update to the 1.x line in a few months that will address any minor differences in the two versions. At that point we will still keep the two lines in sync: 1.10 and 2.0, 1.11 and 2.1, etc.

If you’d like to try jQuery 2.0 on web sites where you still need to support IE 6, 7, and 8, you can use conditional comments. All browsers except old IE will get the second script and ignore the first:

<!--[if lt IE 9]>
    <script src="jquery-1.9.1.js"></script>
<![endif]-->
<!--[if gte IE 9]><!-->
    <script src="jquery-2.0.0b3.js"></script>
<!--<![endif]-->

Remember, however, that jQuery 1.x continues to work on all the browsers that jQuery supports.

What’s New

Here are the major changes since Beta 2:

Node.js compatibility. If the jquery.js file is included in Node via require(), it will export the jQuery object.

Windows 8 Store App compatibility. Some feature detects that were only needed for IE 6/7/8 were removed to prevent a security exception in Windows Store apps.

More bug fixes. This beta includes fixes to bugs reported since jQuery 2.0 beta 2 and jQuery 1.9.1 were shipped. The complete list is below.

Remove jQuery.support.boxModel. Nobody should be using this property since it has been deprecated since jQuery 1.3 and jQuery itself has never supported Quirks mode.

Further nips and tucks to the code. Fixing bugs often adds more bytes, but we’ve been able to actually reduce the size of the full minified/gzipped build by a couple of dozen bytes.

The wrap methods can now be excluded in a custom build. If you (and the plugins you use) aren’t calling any of the wrap methods like .wrapAll() or .unwrap(), you can leave them out of your custom build.

Custom builds under 10k bytes! If you’re able to exclude all the optional modules, you’ll be rewarded with a custom build that’s only 9,226 bytes when minified and gzipped. See the beta 2 blog post for more information on how to do custom builds.

The full list of commits is available on GitHub and the closed bug tickets are below. Many thanks to Rick Waldron, Michal Golebiowski, Li Xudong, Timmy Willison, Nguyen Phuc Lam, Steven Benner, Tom Fuertes, Richard Gibson, Scott González, and Oleg Gaidarenko for their efforts on this beta.

Ajax

Build

Core

Css

Deferred

Effects

Event

Manipulation

Selector

Support

Traversing

jQuery 2.0 Beta 2 Released

Posted on by

The next beta of jQuery 2.0 has arrived! This beta has several changes and tweaks based on the feedback we received from those of you who generously tested the first beta. We really need you to test this version as well and let us know what still needs to be done. We believe this version is very stable and ready for you to try; don’t wait until the final release and then find out your code doesn’t run with it.

Remember that jQuery 2.0 will not run on IE 6, 7, or 8; we’re saving that duty for jQuery 1.9. We fully expect that most Internet web sites may continue to use jQuery 1.x for quite a while, as long as older versions of IE still comprise a large proportion of web surfers. And so the jQuery team will also continue to support both the jQuery 1.x and 2.x lines. Don’t feel like you’re missing something or falling behind by using 1.9 on your web site, since the APIs for 1.9 and 2.0 are the same.

If you’d like to try jQuery 2.0 on web sites where you still need to support IE 6, 7, and 8, you can use conditional comments. All browsers except old IE will get the second script and ignore the first:

<!--[if lt IE 9]>
    <script src="jquery-1.9.1.js"></script>
<![endif]-->
<!--[if gte IE 9]><!-->
    <script src="jquery-2.0.0b2.js"></script>
<!--<![endif]-->

There are lots of other environments where jQuery 2.0 should fit in very well. Here are a few suggestions:

  • Google Chrome plugins
  • Mozilla XUL apps and Firefox extensions
  • Firefox OS apps
  • Chrome OS apps
  • Windows 8 Store (“Modern/Metro UI”) apps
  • BlackBerry 10 WebWorks apps
  • PhoneGap/Cordova apps
  • Apple UIWebView class
  • Microsoft WebBrowser control
  • Cheerio or jsdom with node.js
  • Intranet applications

On the node.js front, the jQuery team now owns the “jquery” and “jQuery” names in npm and will soon be shipping 2.0 releases there.

You can get this latest beta from the jQuery CDN:

http://code.jquery.com/jquery-2.0.0b2.js

To run pre-1.9-era code with jQuery 2.0, you can also use the jQuery Migrate plugin to restore deprecated features from those older versions and/or diagnose compatibility issues. We strongly recommend that you do use Migrate for older code, it will save a lot of time and trouble in debugging.

What’s New

Lots of bug fixes: All the relevant fixes from jQuery 1.9.1 and 1.9.2pre have been incorporated into jQuery 2.0 beta 2. We sadly had to back out some optimizations that aren’t supported by older versions of WebKit such as Android 2.3, but most of those didn’t have a significant size impact. Still, we plan to bring them back as soon as we can! To help us out, anytime you see an old Android phone you can “accidentally” whack it with a hammer.

New .data() implementation: This new code is a complete rewrite by Rick Waldron. It’s smaller, simpler, and much more maintainable than the old code.

Increased modularity in custom builds: You can now exclude all the redundant event shorthands such as .mouseover(...) if you’re willing to use .on("mouseover"...) instead.

Minimal selector engine: Richard Gibson created a small wrapper around the browser’s native querySelectorAll and matchesSelector APIs that can be used as a replacement for the full-fledged Sizzle selector engine. Be aware, however, that there are major differences in the supported selectors and semantics. This minimal engine does not support jQuery selector extensions like :radio or :first for example.

Custom Builds

We’d love for you to try out the custom build system which is based on grunt. The README gives more detail on making a custom build. As of beta 2 you can replace Sizzle with a simple selector engine and exclude css, event aliases, animations, offset, and deprecated functionality such as .andSelf() that has not yet been removed. In addition you can exclude a subset of the script, JSONP, or XMLHTTPRequest transports. That’s right, reject any module in our jQuery reality and substitute your own.

Here is an example of what you can save with modular builds. Let’s say you don’t need the css, offset, dimensions, or deprecated modules and plan to do animations completely via CSS transitions and classes. In addition you only use JSONP via $.ajax(). You’ll use .on() for event management and keep your selectors simple so that the minimal selector engine can do the job. The build command to do that is:

grunt custom:-sizzle,-css,-event-alias,-effects,-offset,-dimensions,-deprecated,-ajax/xhr

The resulting file from that custom build is just 17,530 bytes when transferred by gzip, which is 40 percent smaller than the full 2.0 build at 29,387 bytes gzipped. For comparison, the current 1.9 branch is 32,770 bytes gzipped.

We still think that the vast majority of jQuery users are best served by the simplest option: Use the full version of jQuery, served from a CDN or your local server. Most jQuery plugins are not written in a way that would allow you to use a subset of jQuery core functionality — after all, they never anticipated any of it would be missing! But for situations where it’s worth the time to determine those dependencies, jQuery’s current level of modularity offers awesome flexibility.

Many thanks to the people who contributed fixes to this release: Adam Coulombe, Andrew Plummer, Danil Somsikov, Dmitry Gusev, Isaac Schlueter, James Burke, Jean Boussier, Julian Aubourg, Karl Sieburg, Mark Raddatz, Mike Sherov, Nguyen Phuc Lam, Oleg Gaidarenko, Pascal Borelli, Richard Gibson, Rick Waldron, Ryunosuke Sato, Timmy Willison, and Timo Tijhof. Special recognition to Scott González for his minimalist work simply titled, “Whitespace“.

Changelog

Ajax

Build

Core

Css

Deferred

Effects

Event

Manipulation

Selector

Support

Traversing

jQuery Migrate 1.1.1 Released

Posted on by

To magnify your jQuery migration pleasure, version 1.1.1 of the jQuery Migrate plugin is now available. This plugin can greatly simplify the process of moving older jQuery code to version 1.9.0 or higher of jQuery by identifying deprecated features. It can also restore those features so that older code can run without needing any changes at all. We strongly recommend that you use this plugin in your initial jQuery 1.9 upgrade — make it easy on yourself, that’s why we wrote this plugin!

If you haven’t yet read about jQuery 1.9 and the Migrate plugin, we recommend that you check out the jQuery 1.9 upgrade guide and the original jQuery 1.9 blog post.

Using the plugin is easy; just include it immediately after the script tag for jQuery, for example.

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.1.js"></script>

For more information, see the jQuery Migrate documentation.

Here are the items we’ve polished for this version; you can see the complete list at Github. Many thanks to jQuery team member Richard Gibson for his help on this release.

  • Remove “use strict”: Not all code is compatible with JavaScript’s “use strict” mode, so we’ve removed this restriction for the same reason we did in jQuery 1.9.1. This fixes some issues with diagnostic software that uses arguments.caller and with form processing in ASP.NET.
  • $.parseJSON in $.ajax: In 1.9 when an $.ajax() call specifies a dataType: "json" the returned value MUST be valid JSON. Older versions treated an empty string as a success even though it was not valid JSON. The Migrate plugin will now warn about this, treat the result as success and return null as older versions did.
  • Preserve custom $.browser: If the $.browser object has been changed or augmented by code that loaded before jQuery Migrate, those changes will now be preserved. However, we still advise the Migrate plugin be loaded immediately after the jQuery core file.

Happy upgrading!

jQuery 1.9.1 Released

Posted on by

The jQuery team is pleased to announced that jQuery 1.9.1 is available! This release addresses the bugs and regressions that have been reported during the past few weeks. Whether you’re using 1.9.0 or using an older version, these are the droids you’re looking for.

Please, please, please, use the jQuery Migrate plugin and look at the upgrade guide if you’re just starting your upgrade to jQuery 1.9. The plugin will quickly find and fix any compatibility issues, just look in the browser console. Once you fix the warnings you can remove it. Or, leave the plugin in place until you have the chance to fix your code and plugins to make them 1.9-compatible.

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>

We’ve sent the files to the Google and Microsoft folks, so you should see them up on their CDNs shortly.

Many thanks to those of you who reported bugs, and to the following people who contributed patches to the 1.9.1 release: Adam Coulombe, Andrew Plummer, Corey Frang, Danil Somsikov, Jean Boussier, Julian Aubourg, Mike Sherov, Oleg Gaidarenko, Richard Gibson, Ryunosuke Sato, and Timmy Willison.

Gold-leaf-cluster thanks to Paul Irish, who mobilized special forces to find a solution for 13274!

Change Log

Ajax

Build

Deferred

Effects

Event

Manipulation

Selector

Support

Traversing

jQuery Migrate 1.1.0 Released

Posted on by

Thanks for all your feedback on jQuery 1.9.0! We’re preparing an update to address the issues you’ve found already, but in the meantime here’s a new version of the jQuery Migrate plugin. The plugin can be used with either 1.9 or 2.0 to detect deprecated and removed features, or to restore old features for those sticky situations where you need old code to run with new jQuery. The plugin and the messages it generates are documented in the project README.

Judging by many of the questions and bug reports we’ve gotten, far too many of you are trying to do an upgrade to jQuery 1.9 without also using jQuery Migrate. Stop hitting yourself! We created this plugin to make things easy on you. Just include the plugin after your jQuery file to see if it gives you any warnings. The updated jQuery Migrate plugin is available on jQuery’s CDN, and should be available on the Google and Microsoft CDNs within a few days:

<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>

With this development version, warning messages appear on the browser’s console. They all start with JQMIGRATE so they’re easy to find. Just match up each message with its description in the warning list to determine what it means and how it can be fixed.

In a perfect jQuery world, you’ll be able to update your code and run without the jQuery Migrate plugin. But we’re realists, and know that it may be a while before you and the authors of your plugins can get around to fixing compatibility issues. We’ve got you covered there as well. Just use the minified version and the plugin’s fixes will stay, but the warnings will be silenced so you can deploy to production:

<script src="http://code.jquery.com/jquery-1.9.0.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.min.js"></script>

Finally, remember that you can include the jQuery Migrate plugin with your existing copy of jQuery all the way back to 1.6.4, to see what issues may arise when you do get around to upgrading.

What’s New?

For a detailed list of the issues that were closed you can see the issue tracker; here are the important highlights:

  • Traces by default: In browsers that support console.trace(), a stack trace will appear after each warning message to make it easier to diagnose. If you prefer to do your own debugging and want to reduce the console clutter, set jQuery.migrateTrace = false.
  • A “Logging is active” message: This message shows up when the plugin starts to let you know it is running. If you don’t see any other messages on the console when testing your pages, you done did good.
  • Invalid JSON: Before jQuery 1.9.0, $.parseJSON() would accept some invalid JSON values such as "" or undefined and return null rather than throwing an error. Migrate 1.1.0 warns about this and restores this old behavior.
  • HTML strings with leading whitespace: jQuery 1.9 restricts the strings processed by $() for security reasons. Although we recommend you use $.parseHTML() to process arbitrary HTML like templates, the 1.1.0 version of the Migrate plugin restores the old behavior.
  • Inappropriate warnings: The Migrate plugin showed a warning for $("<button>", { type: "button" }), which was not correct since that form is allowed on IE6/7/8. That’s been fixed.
  • We’re in the jQuery Plugins site: To set a good example, the jQuery Migrate plugin is on the Plugins site! You can always find it on Github as well.

jQuery 1.9 final, jQuery 2.0 beta, Migrate final released

Posted on by

Are you sitting down? Well sit down, in front of your computer, and start downloading. We have several new jQuery releases for you to test. For your convenience, jQuery can even be downloaded while standing.

First up are the final versions of jQuery 1.9 and jQuery Migrate 1.0. We think these releases are pretty solid, because very few of you reported any problems in the beta versions. Just be sure to read the information in the jQuery 1.9 upgrade guide so that your transition will be smoother.

Next, take out your sunglasses. Today you get a glimpse at the future, and it’s bright. jQuery 2.0 is in beta test! We know it’s a lot to take in, so let’s recap the positioning for jQuery 1.9 and 2.0:

  • jQuery 1.9 and 2.0 have the same API. Several deprecated features such as $.browser have been removed from both versions. It’s all laid out in the jQuery 1.9 upgrade guide.
  • jQuery 1.9 runs on Internet Explorer 6, 7, and 8 (“oldIE”), just like previous versions. Consider it a cleaner, slimmer, modern-API upgrade from jQuery 1.8.
  • 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.
  • The team is supporting both jQuery 1.9 and 2.0 into the future. You choose which version you want to use based on your needs.

The jQuery Migrate plugin can be used with either 1.9 or 2.0 to detect deprecated and removed features, or to restore old features for those sticky situations where you need old code to run with new jQuery. The plugin and the messages it generates are documented in the project README.

If you’re on a recent version of jQuery core and have been avoiding deprecated features, these new jQuery releases may work for your code right out of the box. (Just remember, jQuery 2.0 doesn’t work on IE 6, 7, or 8!) Still, we recommend that you always start by including the jQuery Migrate plugin to see if it gives you any warnings.

The jQuery 1.9 final files are available on jQuery’s CDN, and should be available on the Google and Microsoft CDNs within a few days:

<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.0.0.js"></script>

Or, for testing jQuery 2.0 beta 1, use the jQuery CDN:

<script src="http://code.jquery.com/jquery-2.0.0b1.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.0.0.js"></script>

For diagnostic purposes, you can also include the jQuery Migrate plugin with versions of jQuery all the way back to 1.6.4 to see what changes may cause issues with your code when you finally upgrade.

No matter which version of jQuery you use with the plugin, be sure to open the browser’s console to see what warnings or errors are being generated. Warnings given by the plugin start with the word “JQMIGRATE” and are listed in the plugin’s documentation. The description explains why the warning was given and how it can be fixed.

What’s New in 1.9

It may be a few weeks before the complete documentation for this release lands at api.jquery.com, especially since the API and other documentation sites are in the process of their own upgrade. For now, here’s a summary of what’s new and changed.

Streamlined API: Many deprecated and dubious features have been removed, as documented in the upgrade guide.

New .css() multi-property getter: Now you can pass .css() an array of CSS property names and it will return an object with the current values of all those CSS properties:

var dims = $("#box").css([ "width", "height", "backgroundColor" ]);
//  { width: "10px", height: "20px", backgroundColor: "#D00DAD" }

Enhanced cross-browser CSS3 support: jQuery 1.9 now supports the following CSS3 selectors across all browsers, all the way back to IE6: :nth-last-child, :nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type, :only-of-type, :target, :root, and :lang.

New .finish() method: This method can be used to immediately complete all the animations queued on an element. The jQuery 1.9 RC1 blog post has more information and an example.

Source map support: You can now run the minified version of jQuery but use source maps for debugging. This can be extremely valuable for tracking down problems on a production web site. See the jQuery 1.9 RC1 blog post for a full description.

Many, many bug fixes: We’re especially proud of what we hope will be the final set of fixes for obscure issues in IE 6, 7, and 8. See the changelog below for a complete inventory.

Getting started with 2.0

Since jQuery 2.0 has its foundation in the work for jQuery 1.9, all the discussion in the upgrade guide also applies to 2.0. The Migrate plugin will identify many of these issues for you automatically.

If you’re using jQuery in non-web-site HTML situations such as an Android, iOS, or Windows 8 app, or a Chrome/Firefox add-on, jQuery 2.0 is an awesome choice. You can even use jQuery 2.0 on web sites if you don’t support oldIE or don’t mind using conditional comments:

<!--[if lt IE 9]>
    <script src="jquery-1.9.0.js"></script>
<![endif]-->
<!--[if gte IE 9]><!-->
    <script src="jquery-2.0.0.js"></script>
<!--[endif]-->

With this first beta of jQuery 2.0 we’ve made a huge down payment on major cleanup, cutting the size of the library by more than 10 percent. But we’re nowhere near done. There is more refactoring possible now that we can consistently depend on modern JavaScript, CSS, HTML, and DOM features being there. We’ll continue to tighten and clean up the code before 2.0 ships, and extend our work to make more functionality optional to shrink the size of custom builds.

They Built This For You

Many thanks to the people who have contributed to these two releases since 1.8.3 was shipped: Akintayo Akinwunmi, Alexander Farkas, Allen J Schmidt Jr, Ben Truyman, Bennett Sorbo, Callum Macrae, Carl Danley, Corey Frang, Daniel Gálvez, Dan Morgan, David Bonner, David Fox, Devin Cooper, Elijah Manor, Erick Ruiz de Chavez, Greg Lavallee, Ismail Khair, James Huston, Jay Merrifield, Jonathan Sampson, Julian Aubourg, Marcel Greter, Matt Farmer, Matthias Jäggli, Mike Petrovich, Mike Sherov, Oleg Gaidarenko, Paul Ramos, Richard Gibson, Rick Waldron, Rod Vagg, Roland Eckl, Sai Wong, Scott González, Sebi Burkhard, Timmy Willison, Timo Tijhof, Tom Fuertes, Toyama Nao, and Yi Ming He. Good work guys!

jQuery 1.9.0 final and 2.0.0 beta Changelog

Any tickets listed here that are not related to IE 6/7/8 support are also in the jQuery 2.0 beta.

Ajax

Attributes

Build

Core

Css

Data

Deferred

Effects

Event

Manipulation

Misc

Offset

Selector

Support

Traversing

The State of jQuery 2013

Posted on by

My fellow web developers, the state of jQuery is strong.

On January 14, 2006, John Resig attended BarCampNYC and made a presentation about his new project called jQuery. In a contemporary blog post John said, “This code revolutionizes the way you can get JavaScript to interact with HTML.” It was a bold statement, but in retrospect we know it was an understatement.

Seven years after John introduced jQuery to the world, the JavaScript library he created has continued to evolve. Today, jQuery is used by more than half of the top 100,000 sites and is the most popular JavaScript library by far.

Last year, jQuery projects moved from under the wing of the Software Freedom Conservancy to our own non-profit organization: The jQuery Foundation. This new Foundation was created not just to foster jQuery code projects, but to advocate for the needs of web developers everywhere. We’re starting to see the fruits of that labor.

To serve the evolving needs of web developers, jQuery has grown far beyond the core library. jQuery UI provides a rich set of user interface widgets that share a consistent and common set of events, programming conventions, and visual styles. jQuery Mobile offers a framework designed to simplify web site and HTML app development on mobile devices. Additional jQuery Foundation projects such as Sizzle, QUnit, and TestSwarm provide valuable components and tools for web development.

Anniversary Announcements

During the coming two weeks you’ll hear more about each of these jQuery Foundation initiatives:

jQuery 1.9 final: This latest version of jQuery core provides support for a full spectrum of browsers, from IE6 all the way to the most recent releases of every major browser.

jQuery 2.0 beta: Here is your taste of the future, a jQuery that can be faster and smaller without the need to support IE 6, 7, or 8. It’s a great choice for platform-specific HTML applications.

jQuery Migrate 1.0 final: Use this plugin to find things that may cause upgrade issues when you move up from older jQuery versions, and to allow older code to work with either jQuery 1.9 or 2.0.

jQuery UI 1.10 final: This version of jQuery UI includes API redesigns for both the Dialog and Progressbar components, in addition to a healthy set of fixes to other components.

New and remodeled web sites: All jQuery sites are being updated with a new look, and we’re encouraging contributions via Github. The most exciting news of all? The Plugin site returns!

Conferences: Our next conference is being held in Portland Oregon on June 12-14, so save the date! Ticket sales and a call for speakers will open on January 25th at noon Eastern time. Details of future conferences are coming soon; they include Austin Texas in September 2013, San Diego California in February 2014, and Chicago Illinois in July 2014.

Membership: Our new program lets you or your company show support by donating to the jQuery Foundation; you’ll get benefits such as t-shirts, hoodies, and discounts on conference tickets.

jQuery’s Mission

With the impending arrival of jQuery 2.0 some people have been asking, “If jQuery doesn’t have to worry about IE 6, 7 or 8 anymore, where does it go now? Aren’t cross-browser issues the whole reason for jQuery’s existence?”

First of all, let’s be very clear: The jQuery team does “worry about” IE 6/7/8, with jQuery 1.9. We’ve created a legacy-free jQuery 2.0 in order to address the many situations where older versions of IE aren’t needed. Some glorious day in the future, jQuery 2.0 will be the only version you’ll need; until then we’ll continue to maintain jQuery 1.9.

Second, jQuery wasn’t just created to iron out browser differences. It introduced a concise, powerful, and expressive API for managing HTML documents that is far better than the original W3C DOM APIs. Using the jQuery API, developers have created reusable jQuery plugins that make the process of building a web site or HTML application much easier. jQuery is a great choice even for an iPhone HTML app that will never see a different web platform.

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!

In fixing and patching these differences, we often act as an advocate for web developers to the browser makers and standards organizations. We want jQuery APIs to be consistent and return useful results, even when browser bugs or ill-conceived standards dictate otherwise. It’s not always easy to do that.

Sometimes, doing the right thing requires changes to the standards, or new standards altogether. For some examples of that, see the work Mike Sherov has done to fix getComputedStyle(), or the efforts of Mat Marquis and others to create a responsive image tag. Team members Yehuda Katz and Rick Waldron are participating in the W3C and ECMA standards groups that define the technologies we all use.

Let’s Work Together

All of these benefits to the web development community are delivered by a dedicated group of jQuery team members. We’re proud to have developers like these working on behalf of the jQuery Foundation to advocate for the needs of the community. The majority of the team volunteers their time, or has their time subsidized through the generous donation of their employer. But there is always more work to do than the team can possibly tackle. Here are ways you can help:

Join the jQuery Foundation. As a member, you’ll get an awesome annual membership gift such as a t-shirt, hoodie, or bag, depending on your level of contribution. Your cash donations can help to keep our operations going. We’ll be announcing a memebership program in a few days as part of our anniversary celebration.

Test beta versions of jQuery projects as soon as they arrive. We want to find and fix problems before the final release. Beta versions are announced on the jQuery blogs, and bug reporting procedures are given in the blog posts as well. Read through the documentation and let us know when information is incorrect or missing. As Linus’ Law says, “Given enough eyeballs, all bugs are shallow.”

Write code, documentation, or web sites for a jQuery project. It’s not just the libraries themselves that need volunteers. The jQuery Foundation has many, many web sites at this point, and those sites always need contributions of code, documentation, or design. Watch for a blog post soon about a new site for contributors.

Get your company involved. If your company encourages employees to do open source work, consider doing that work on jQuery Foundation projects. Companies that wish to provide services and/or financial support can become corporate members of the jQuery Foundation.

Share your knowledge with the jQuery community. Join the discussion on our jQuery forum, on Stack Overflow, at user-group gatherings and conferences, or anywhere else you find jQuery being the hot topic.

Thank You!

As you can tell, the jQuery Foundation was very busy in 2012, and we’re determined to continue that pace in 2013.

We couldn’t have made such incredible progress without support from members and sponsors. jQuery Foundation member companies include WordPress, Media Temple, Adobe, RIM, Apigee, Intel, Gentics, BNOTIONS, White October, Bitovi, Davinci, Application Craft, GitHub, Go Daddy and MJG International. Significant support has also been provided by Bocoup, Filament Group, and their staff.

jQuery’s success isn’t ours alone; the web development community around the world deserves much of the credit. The breadth and scope of the jQuery ecosystem shows that it is thriving, and it continues to grow thanks to your support. Let’s make 2013 another great year for web developers!

Dave Methvin
President, jQuery Foundation

jQuery 1.9 RC1 and Migrate RC1 Released

Posted on by

Drop everything and start testing, jQuery 1.9 Release Candidate 1 is now available! Today we’re also releasing RC1 of the jQuery Migrate plugin, to help in migrating and upgrading your older jQuery code and plugins. We really need your help to make sure this code is free of bugs and ready to release.

The jQuery 1.9RC1 files are available on jQuery’s CDN. We recommend that you start by including the jQuery Migrate plugin. Be sure to check the browser’s console for warnings, which all start with JQMIGRATE and are described in the plugin’s documentation. Just replace your current jQuery include with this:

<script src="http://code.jquery.com/jquery-1.9.0rc1.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.0.0rc1.js"></script>

For diagnostic purposes, you can also include the jQuery Migrate plugin with versions of jQuery all the way back to 1.6.4 to see what changes may cause issues with your code when you do upgrade. At minimum, please test your site with your existing jQuery version and the jQuery Migrate plugin to see what it reports. Our goal is to make the jQuery Migrate plugin into a tool that can smooth out any bumps in your upgrade road.

If you haven’t looked at the previous 1.9 beta, check out the jQuery 1.9 Upgrade Guide for information about what has changed in this go-round. There’s been quite a bit of API cleanup in 1.9, and the jQuery Migrate plugin is your friend when it comes to finding issues.

In the last beta we introduced a powerful CSS array getter that simplifies and optimizes getting multiple properties. But then we looked, and oh, I dunno, it seemed like this release just needed to “pop” more. So we added more features to make your development life easier.

New! Sizzle Selectors

Sizzle now supports the following additional CSS3 selectors: :nth-last-child, :nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type, :only-of-type, :target, :root, and :lang. That means all those selectors are usable in every browser jQuery supports all the way back to IE6, regardless of native browser support for the selector. There are only three remaining selectors unsupported by Sizzle/jQuery (:link, :visited, and :hover) which we won’t implement due to the overhead of events that would be required to track active elements.

New! .finish() Method

jQuery animations have gotten even better, and our API improved in the process. It all started with a suggestion to eliminate the Boolean trap posed by the .stop(Boolean, Boolean) signature. During that discussion it became clear that we didn’t have a way to handle one of the most useful cases: running all queued animations to their final value. So we added one, .finish(). The best way to show its benefits is with an example.

As you can see from the example, most uses of the .stop() API requiring Boolean arguments can be replaced with some combination of .stop() (with no arguments), .clearQueue() and/or .finish() and be less cryptic. We’re not removing the old behavior though, so any existing code should work fine. We’d prefer that you use .finish() when appropriate, since it reads better and avoids confusing Boolean parameters. And, when you need to go to the end of a whole series of animations, .finish() will do that in 1.9 when nothing would before.

New! Source Maps

jQuery 1.9RC1 has added the ability to use source maps in browsers that support them. At the moment that’s just Google Chrome, but Mozilla Firefox is planning support as well.

What’s all this about? Well imagine that you are using compressed versions of your files on your production site, including a compressed version of jQuery. You get a report that an important customer is running into a problem. You could debug it a lot easier if you had the uncompressed source, but using that on your high-traffic production site isn’t an option. With source maps, you can let the browser’s debugger “map” the lines in the compressed file into the uncompressed source. That makes it so much easier to set breakpoints, inspect or change values, and see meaningful variable names. This video gives you a taste of what it can do.

The jQuery CDN has the map files for this beta version; the jQuery, Google, and Microsoft CDN versions of jQuery final releases will also get matching source maps from now on. If you are using jQuery 1.9 or 2.0 from the CDN, just check the “Use source maps” option in the debugger and you will be set. Open the uncompressed version of jQuery in the Chrome debugger and you can set breakpoints or inspect variable values there, even though the compressed version is being used!

When hosting your own copy of jQuery, copy the map to your server and use it from there. For simplicity we assume that the compressed and uncompressed copy of jQuery is in the same folder as the map file; this is the case for CDN versions and you should follow the same rule if you make local copies. The map file name is the same as the compressed version, with .map replacing .js. Do not rename the files when you copy them. So, if you were to use a local copy of jquery-1.9.0.min.js the corresponding map file would be jquery-1.9.0.min.map and the uncompressed file would be jquery-1.9.0.js in the same folder.

Congrats, Contributors!

Many thanks to the people who have contributed to the 1.9 release: Akintayo Akinwunmi, Alexander Farkas, Allen J Schmidt Jr, Ben Truyman, Bennett Sorbo, Callum Macrae, Carl Danley, Corey Frang, Daniel Gálvez, Dan Morgan, David Bonner, David Fox, Devin Cooper, Elijah Manor, Erick Ruiz de Chavez, Greg Lavallee, Ismail Khair, James Huston, Jay Merrifield, Jonathan Sampson, Julian Aubourg, Marcel Greter, Matt Farmer, Matthias Jäggli, Mike Petrovich, Mike Sherov, Oleg Gaidarenko, Paul Ramos, Richard Gibson, Rick Waldron, Rod Vagg, Roland Eckl, Sai Wong, Scott González, Sebi Burkhard, Timmy Willison, Timo Tijhof, Tom Fuertes, Toyama Nao, and Yi Ming He.

jQuery 1.9.0RC1 Changelog

Ajax

  • #12004: Rename ajax.type to ajax.method
  • #12550: jQuery Ajax cache=false doesn't always work

Attributes

  • #9905: .removeAttr( "id" ) sometimes crashes IE 7
  • #10299: hrefNormalized === false also needs a propHook
  • #12048: [IE6/7/8] xml set attribute
  • #12584: jQuery wrongly serializes &lt;select&gt; with one disabled &lt;option&gt;
  • #12600: jQuery('select').is('[value="value"]') works inconsistently depending on number of elements returned
  • #12945: attr throws exception in IE9 on Flash &lt;object&gt;s
  • #13011: Setting type attribute on an input doesn't work as intended

Build

  • #12254: Reflected XSS
  • #12490: Move submodule update process to grunt
  • #12725: Avoid localized UTF-8 characters in intro.js @DATE
  • #12741: inconsistent line endings in official jquery-1.8.2.js download
  • #12886: Add source map support for build
  • #13044: Execute all QUnit modules in TestSwarm
  • #13064: Improve test suite fixture cleanup

Core

  • #9469: Remove semi-functional .selector calculation from .pushStack()
  • #9904: Move deprecated functionality to compatibility plugin
  • #10417: jQuery.later
  • #11290: selector interpreted as HTML
  • #11737: Remove jQuery.sub
  • #12107: Change proxy to allow arguments currying without overwriting context
  • #12134: implement HTML5 compilant form data construction into $.fn.serialzeArray
  • #12191: jQuery.type() should return "error" for native ECMAScript Error objects
  • #12519: Public API methods should not have private arguments
  • #12840: Remove (private) parameter "pass" from jQuery.attr and jQuery.access
  • #13021: each() cannot work well with a literal object who has a length member
  • #13075: Performance optimization for $.type
  • #13076: Performance optimization (10-30%) for $("some-selector")

Css

  • #11938: jQuery.css should accept an array to get multiple properties
  • #12990: 'px' automatically added to column-count css property
  • #13088: under IE8, $(selector).attr('style') always return lowercase string

Data

  • #10544: Remove ALL special meanings of "." in keys for $.fn.data

Deferred

  • #11405: deferred.notify() invokes progressCallbacks with deferred as context
  • #13160: Deferred.then doesn't propagete custom context

Effects

  • #12803: Smarter hook point for jQuery.timer

Event

  • #3827: Checkbox state inconsistent in click event handler
  • #12061: $(window).beforeunload() clobbers previous handler and return values
  • #12518: Don't use offsetWidth in jQuery.event.trigger()
  • #12610: jQuery.event.dispatch should remove window.event
  • #12736: Move pseudo:hover to jquery-compat / deprecated.js
  • #12739: Name: Passing in an Event to trigger strips namespace
  • #12827: Remove "exclusive" events
  • #12828: Remove event properties: attrChange attrName relatedNode srcElement

Manipulation

  • #4087: insertAfter, insertBefore, etc do not work when destination is original element
  • #9646: IE7: Cloning of form-elements and changing their names also changes the name of the elements that are cloned.
  • #10470: wrap() evaluates scripts
  • #11226: .after and .before returns incorrect data for $('not_existing_element')
  • #11230: .appendTo .prependTo .insertAfter .insertBefore returns incorrect data for $('not_existing_element')
  • #11280: appending elements to an object element fails in IE &lt; 9
  • #11795: Resolve script manipulation/execution inconsistencies
  • #12120: Inconsistency of .end() with respect to .after()
  • #12336: Calling $('#select').empty() should set options length to 0
  • #12392: Elements created from HTML strings have a parentNode
  • #12449: replaceWith() doesn't clone elements where required
  • #12503: before/after will choke if collection has not first disconnected node
  • #12777: Applets don't work when appended on IE
  • #12863: behavior:url(#default#savehistory) causes event error on oldIE
  • #12957: Improve wrapMap
  • #13019: New pre-1.9 .replaceWith() behavior leaks data and events
  • #13094: If to jQuery#before passed function argument it should receive index of the current element in the set

Misc

  • #12758: Make sure Summit new authors are credited

Offset

  • #6446: Mobile Safari 4.0.4: $.offset.top() reports wrong position after scroll

Selector

  • #11115: ".is()" and ".filter()" disagree on attribute selector "[checked]"
  • #12856: Syntax error, unrecognized expression in jquery 1.8+
  • #13070: filter()/is() does not work correctly with attribute equals selector which contains special characters

Support

  • #12569: Improve feature detect for oldIE event bubbling
  • #12869: Support tests affect page layout in IE8/9/10 running in IE7 mode

Traversing

  • #12009: jQueryObject.find(element) corrupts the stack
  • #12816: .find can return elements in the wrong order