jQuery 1.8 BETA – What you need to know

Sam Deering

jquery 1.8 beta

The jQuery Core Team has been heads-down working on jQuery 1.8, and our first beta release is now available! You can get the code from the jQuery CDN.

View the code

http://code.jquery.com/jquery-1.8b1.js

Important Stuff

CUSTOM BUILDS

As of jQuery 1.8, you can build a custom version of jQuery that excludes one or more modules if you do not need their functionality.

IMPROVED BROWSER SPECIFIC CSS

jQuery 1.8 eases the pain a bit. We automatically take the non-prefixed property name and generate the prefix that is appropriate for the current browser, so you don’t have to. For example, on Chrome the jQuery call $(“#myscroll”).css(“marquee-direction”, “backwards”) will set the CSS to -webkit-marquee-direction: backwards.


NEW $.ANIMATION FUNCTION

If you need to support older browsers without built-in animations, the new $.Animation provides a solid foundation and fixes many bugs from previous versions.

IMPROVED SIZZLE CSS SELECTOR ENGINE

Sizzle handles many more edge cases and bugs, including improved support for multiple combinators (~ > +) and better detection of browser bugs in querySelectorAll.

NEW $.parseHTML() FUNCTION

jQuery 1.8 introduces a new method: $.parseHTML. It lets you specify strings as HTML and know that they will be parsed as HTML, something that $() cannot do since it also interprets strings as selectors.

// data: string of html
// context (optional): If specified, the fragment will be created in this context, defaults to document
// scripts (optional): If true, will include scripts passed in the html string
parseHTML: function( data, context, scripts ) {

$.browser STILL THERE IN 1.8

$.browser. As of jQuery 1.9 we’ll remove it entirely and you’ll need to use the 1.9 compat plugin.

ASYNC OPTION STILL PRESENT
Discussions about removing it from version 1.9 as it hangs loading of JavaScript. http://bugs.jquery.com/ticket/11013 It is still default true;

#11013: Deprecate/remove async option from $.ajax

$.SIZE DEPRECATE
http://bugs.jquery.com/ticket/10657 The .size() method is functionally equivalent to the .length property; however, the .length property is preferred because it does not have the overhead of a function call. Use .length(). $.size() is an alias to $.length().

#10657: Deprecate/remove jQuery#size() in favor of jQuery#length

Read the official blog post

Win an Annual Membership to Learnable,

SitePoint's Learning Platform

  • http://tbranyen.com/ Tim Branyen

    I don’t think async; false is gone. It’s still in the source.

    • http://jquery4u.com/ jQuery4u

      Thanks Tim, I read that wrong it seems it’s still present and is default async = true/async for all AJAX requests except appending multiple scripts it is set to false (see domManip() function async: false,).

  • Dave

    Both async:false and $.fn.size() are still there. The tickets were simply for deprecation.

    • http://jquery4u.com/ jQuery4u

      Hi Dave, yeah true size() is just an alias for .length.

      // The number of elements contained in the matched element set
      size: function() {
      return this.length;
      },