新闻

Modernizr 2.5: Supercharged for 2012

Modernizr 2.0 came out more than eight months ago; we’ve not sat still in the period since, and today we’re proud to announce the release of Modernizr 2.5, our biggest update yet!

New in 2.5

The list of new things in 2.5 is too big for GitHub to handle, but here are the highlights:

  • More than 60 new feature detects for emerging browser features; check out the full list or peruse all of the community-driven tests in our feature-detects folder.
  • We now have a super robust and integrated test suite. Paul did a great video detailing how it works.
  • Brand new embedded and included micro-libraries: html5shiv 3.2 and yepnope .js 1.5.
  • Modernizr.prefixed() can now detect prefixed DOM features and give you a hook. E.g.: Modernizr.prefixed('requestAnimationFrame', window) // rAF function
  • Bugfix for possible false negative when browser support for prefixed CSS Transforms is sunsetted.
  • We now ship with a Function.prototype.bind polyfill included by default. You’re welcome!

Modernizr 2.5 introduces some minor backwards-compatibility breaks due to changes in features and behavior.

  • We no longer include Respond.js in the builder. If you still require Respond.js in your project, just include it manually.
  • Modernizr._domPrefixes has been renamed to Modernizr._cssomPrefixes, and a new, lower-case Modernizr._domPrefixes has been introduced.
  • We’ve removed KHTML prefix testing, due to lack of usage.

We encourage all users to upgrade to Modernizr 2.5, as there should be no regressions. If you do happen to encounter issues, please file them on GitHub.

Thanks

This great release would not have been possible were it not for the many contributions from people who volunteered bug reports, bug fixes and all new tests. We’ve made a dedicated page to thank everyone who contributed to Modernizr 2.5; this release has been the most collaborative effort yet for Modernizr, and we couldn’t be more excited about that.

We’re similarly excited to announce the expansion of the team. Ryan Seddon has been made an official member at last, and we also welcome Alexander Farkas to the team. And speaking of Ryan, he’s done a great Learnable course on Modernizr, so if you’re relatively new to the library you should check it out!

Elsewhere

While not a Modernizr effort, we do want to bring some attention to a very useful new reasource, ideal for people who use Modernizr: HTML5 Please. Together with Can I Use…, these two sites should cover all your questions over which features are reliable and safe to use based on what audiences you need to support.

We’d also like to note that our HTML5 Cross Browser Polyfills wiki is still growing, with many more polyfills having been added.

Modernizr 2.5 is the best starting library for anyone taking advantage of the latest in HTML5 and related technologies, and we hope you’ll enjoy it.


Update Feb 8: we’ve included another couple of small—but significant—updates, and have released Modernizr 2.5.2.

Notably, this latest update includes html5shiv 3.3, which features an up to 16x performance increase over the shiv that was bundled in Modernizr 2.0. The html5shiv team (Jonathan Neal, John-David Dalton, and Modernizr team member Alexander Farkas) has been hard at work (view changelog) making this foundational piece of the HTML5 infrastructure fast and robust. (To be clear, this is the exact same shiv available in Remy Sharp's googlecode repos.) Plus, using Modernizr 2.5 (with the included html5shiv 3.x), you no longer need innerShiv; the fix is automatic.

Additionally, our download builder now ships with Yepnope 1.5.2.

We also want to highlight a few more changes from 2.5:

  • We’ve toughened up canPlayType checks for Firefox 3.5.0, 3.5.1 and 4.0.0 - 4.0.4
  • In iOS5 Private Browsing mode you can use localStorage.getItem but it throws an exception for setItem. We test it out and set Modernizr.localStorage to false if we cannot store.
  • We now have a <datalist> detect with no false positives! It’s accessible through Modernizr.input.list [#146]
  • If you use the transitionEnd event, we’ve documented the correct IE10 and spec’d behavior.
  • If you, by chance, have a class of oh-no-js-oh-my on the <html> element we wont remove it anymore as part of our no-js to js switch.
  • The Modernizr wiki has been reorganized. Much cleaner!