jQuery 1.9 Beta 1 Released

Posted on by

You’ve been good boys and girls this year, so look what Santa left under the source tree: jQuery 1.9 Beta 1! We’ve made a lot of changes this time, so we need your help in testing more than ever. Please don’t leave us feeling awkward at the holiday party with that punch bowl full of warm eggnog and the creepy guy from accounting. Just take a few minutes out of your holiday schedule and try this with your code. It’s a gift we will definitely appreciate.

jQuery 1.9 has removed many of the items we deprecated during the last few versions of jQuery. For that reason, we’re introducing the jQuery Migrate plugin. This plugin restores several of the deprecated and removed features so that existing code can run, without changing the code. However, it’s intended as a short-term stopgap and shouldn’t be used for new work. To make migration easier, the development version (linked below) also provides browser console warnings to let you know which obsolete features the code is still using. See the plugin documentation for a list of messages you may see.

To test, we recommend that you start with the jQuery Migrate plugin since it will warn you about any deprecated features the code may depend on. Just include these two script tags in your code, replacing your existing jQuery script include:



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

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



Be sure to update to the most recent versions of jQuery UI and jQuery Mobile if you are also using them.

If the browser’s console does not show any “JQMIGRATE” warning messages generated by the jQuery Migrate plugin, try removing the jquery-migrate include and try jQuery 1.9 in all its squeaky-clean glory. If you have questions, feedback, or complaints about the beta that aren’t specifically bugs, let us know in the jQuery Forum.

Issues regarding the migration plugin not discussed below or in the upgrade guide can be reported at the jQuery Migrate Issue tracker; include a test case that we can use to diagnose the problem. The best way to do that is create a simple test at jsFiddle.net or jsbin.com. You can this jsFiddle tempate or jsbin template as a starting point; they already contain links to the work-in-progress versions of both jQuery and the jQuery Migrate plugin. Add your code there and post a link to it with your bug report.

If you’re seeing problems after fixing any migration issues, removing jQuery Migrate, and using the 1.9 beta by itself, you can report them at the main jQuery core bug tracker. A test case is essential here as well so that we can analyze the problem. Again, if you have questions, feedback, or complaints about the beta that aren’t specifically bug reports, use the jQuery Forum.

What’s New

The majority of work in 1.9 has revolved around API cleanup. Changes most likely to affect existing code are listed in the jQuery 1.9 Upgrade Guide, and these changes will also carry over to 2.0. The jQuery Migrate plugin will identify many of these issues for you automatically, so it’s good to use the plugin in your initial testing to see if it identifies anything that needs to be changed.

We couldn’t let a version like this escape without adding at least one new feature; it’s a good one.

$(element).css([ name1, name2 … ]) : This is a new getter that retrieves multiple CSS properties for the first element in a collection and returns them as an object with properties. In addition to the shorter code, this signature provides up to 25 percent better performance because it can use the same return value from the browser’s `.getComputedStyle()` method rather calling the method for each css property. Typical use might be like this:

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

Finally, no major version would be complete without fixes for a variety of bugs and peculiar edge cases that you’ve discovered and reported on the bug tracker. Those, along with all the other modifications, are all cataloged in the changelog below.

How It’s Made

Possibly the most exciting news of this beta is that so many contributors — new and veteran — worked to make jQuery better. Our first jQuery Developer Summit in October brought in some incredibly skilled developers that we hope will continue to stay with us, and several new contributors dared to tackle bugs that have been open for more than a year! If you’re interested, you can help out too.

Let’s give a round of applause to the people who contributed their code gifts to this 1.9 beta: 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, Timmy Willison, Timo Tijhof, Tom Fuertes, and Yi Ming He. If you happen to see them under the mistletoe … well, you know what to do.

jQuery 1.9 Beta 1 Change Log

Ajax

#12004: Rename ajax.type to ajax.method

#12550: jQuery Ajax cache=false doesn't always work

Attributes

#10299: hrefNormalized === false also needs a propHook

#12048: [IE6/7/8] xml set attribute

#12584: jQuery wrongly serializes select with one disabled option

#12600: jQuery('select').is('[value="value"]') works inconsistently depending on number of elements returned

#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

#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

Css

#11938: jQuery.css should accept an array to get multiple properties

#12990: 'px' automatically added to column-count css property

Data

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

Deferred

#11405: deferred.notify() invokes progressCallbacks with deferred as 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 < 9

#11795: Resolve script manipulation/execution inconsistencies

#12120: Inconsistency of .end() with respect to .after()

#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

#12957: Improve wrapMap

#13013: Move jQuery.buildFragment() to compat plugin

#13019: New pre-1.9 .replaceWith() behavior leaks data and events

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+

Support

#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

NOTE: Please do not report bugs or other problems via blog comments!