Introduction:Several deprecated features have been removed to provide a slimmer, cleaner library in preparation for version 2.0. It will be the last to support IE6, 7 and 8.

jQuery Migrate Plug-in:

The jQuery migrate plugin should ease your upgrade woes. The plugin provides two essential facilities:

  1. It re-enables deprecated features so your v1.8-compatible code will work again, and
  2. It logs warnings to the developer console when deprecated features are used. You should find it easier to fix issues.

The migrate plugin should be loaded immediately after jQuery, e.g.

<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>

Removed Features:

  • jQuery.browser() — removed
  • .live() events — use .on() instead
  • .die() — use .off() instead
  • .andSelf() — use .addBack() instead
  • .add() — nodes are now returned in document order with disconnected nodes (those not in the document) at the end. All sets which contain disconnected nodes follow this behavior
  • .after(), .before(), .replaceWith() — now return an unmodified jQuery set
  • .appendTo, .insertBefore, .insertAfter, .replaceAll — if no elements can be selected by the target selector, e.g. $(elements).appendTo(“#not_found”)), the resulting set is now empty
  • Ajax events must be attached to the document — not a DOM node, i.e. $(document).ajaxStart(…); rather than $(“#node”).ajaxStart(…);
  • radio/checkbox click events — now returns the checked state rather than the state it would have been in if .preventDefault() were not called
  • Order of focus events — blur events on the previous element are now fired prior to focus events on the new element
  • jQuery(htmlString) — htmlString is only considered to be HTML (rather than a selector) if it starts with a ‘<’ character
  • .attr() — you should normally use .prop()
  • “hover” pseudo-event — “hover” is no longer supported as a synonym for “mouseenter mouseleave”
  • jQuery.ajax returning an empty JSON result — this is now considered to be malformed JSON and throws an error

New Features:

.css() multi-property getter:
It’s now possible to pass an array of CSS property names to the .css() method. It returns an object with the current values, e.g.

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

CSS3 selector support:

The Sizzle selector engine supports the following CSS3 selectors in all browsers: :nth-last-child, :nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type, :only-of-type, :target, :root, and :lang.

.finish() method:

The .finish() method stops all queued animations and places the element(s) in their final state. This could be handled in previous editions using combinations of .stop() and .clearQueue(), but .finish() is easier to use.

Source map support:

Source maps allow you to debug a production site which uses minified scripts or CSS. In essence, the browser’s debugger maps lines in the compressed file to the uncompressed source so it’s easier to view code, set breakpoints, change values etc.

Undocumented arguments of API methods:

Prior to 1.9, several API methods had undocumented arguments that changed their behavior and created the potential for accidental misuse or incorrect duck punching. These arguments have now been removed. Affected methods include jQuery.data(), jQuery.removeData(), and jQuery.attr(). The jQuery Migrate plugin does not support these undocumented arguments because the refactored code no longer requires it.

Other undocumented properties and methods:

The following internal properties and methods were never documented and have been removed in 1.9. Any code that depends on them should be rewritten.

  • jQuery.deletedIds
  • jQuery.uuid
  • jQuery.attrFn
  • jQuery.clean()
  • jQuery.event.handle()
  • jQuery.offset.bodyOffset()

Reference:

http://jquery.com/upgrade-guide/1.9/