It’s been nine months since jQuery 1.7 was released so here we are with a shiny new version to help you write less code in a shorter time while retaining great cross-browser compatibility (for now). Let’s look at the main new features and updates…

More Sizzle

jQuery’s Sizzle selector engine has been optimized for performance and efficiency. It relies on the native querySelectorAll method when it’s available, but even that has implementation differences between browsers. jQuery 1.8 papers over the cracks and still provides coded fallbacks for IE6 and 7.

Automatic CSS Prefixing

When you use a CSS property in methods such as .css() or .animate(), jQuery 1.8 will automatically add any required prefixes. Therefore, you can apply a single transform and -webkit-, -moz-, -ms- and -o- prefixes will be pre-pended.

If you’ve used box-sizing: border-box in your CSS, you’ll also be pleased to hear that width, innerWidth, innerHeight, outerWidth, outerHeight methods are now calculated correctly.

Advanced Animations

The jQuery team admit that animation code had become a little unwieldy. This has been addressed and animation performance has improved as a result.

However, I suspect the days of jQuery and JavaScript-powered animation are numbered. It will never disappear completely but CSS3 offers better and faster effects with less code. Fortunately, you don’t need to include jQuery’s animation methods if you don’t need them…

Increased Modularity

jQuery 1.8 is a few hundred bytes smaller than version 1.7.2, but it’s possible to reduce it further using the grunt-based build system to strip out features you don’t require.

Bugs Squished

Finally, jQuery 1.8 fixes more than 160 bugs. The code base was already rock-solid, so it’s amazing they found so many issues to address.

Time to Upgrade?

Those using v1.7.x can probably switch to 1.8 without incurring significant problems. Older versions should be fine too, but be prepared for some rigorous testing.

That said, issues are often reported within a few days of release so those of a more cautious nature may prefer to wait a few weeks for jQuery 1.8.1.

jQuery is available at CDN-hosted versions will appear shortly.

Tags: HTML5 Dev Center, javascript, jQuery Tutorials & Articles
Craig is a freelance UK web consultant who built his first page for IE2.0 in 1995. Since that time he's been advocating standards, accessibility, and best-practice HTML5 techniques. He's written more than 1,000 articles for SitePoint and you can find him @craigbuckler

Free Guide:

How to Choose the Right Charting Library for Your Application

How do you make sure that the charting library you choose has everything you need? Sign up to receive this detailed guide from FusionCharts, which explores all the factors you need to consider before making the decision.

  • cham soc da

    jQuery 1.8? good

  • hyvaa


  • Diego Andrade

    Good, but since I’m using only the basic features of the framework and making my animations with CSS 3 I think I gonna stay with 1.7 for a while.

  • attack

    What about script templating? Have they added jsRender witth this upgraded version?

Special Offer
Free course!

Git into it! Bonus course Introduction to Git is yours when you take up a free 14 day SitePoint Premium trial.