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…
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.
The jQuery team admit that animation code had become a little unwieldy. This has been addressed and animation performance has improved as a result.
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.
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 jQuery.com. CDN-hosted versions will appear shortly.
How to Hire the Best Freelance Developers in the Gig Economy
By Isabel Nyo,
Hiring freelance developers can be a great way to save money — or lose it. Learn how to navigate Upwork and Fiverr and get great results.
Using Redis with Node.js
By Ivaylo Gerchev,
Need fast data interactions in your Node app? Learn how Redis speeds caching, message brokering, sessions, analytics, streaming and more.
A Comparison of Ruby Version Managers for macOS
By Daniel Kehoe,
If you're a serious Ruby developer, you'll need an up-to-date version, possibly several. We cover the best Ruby version managers for macOS.
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 created enterprise specifications, websites and online applications for companies and organisations including the UK Parliament, the European Parliament, the Department of Energy & Climate Change, Microsoft, and more. He's written more than 1,000 articles for SitePoint and you can find him @craigbuckler.