Java Reference
In-Depth Information
Modernizr fixes these problems by providing a unified API for detecting HTML5 and CSS features
in the browser.
Note Even though Modernizr offers many CSS‐based features, this chapter
focuses on Modernizr's JavaScript capabilities. If you are interested in its CSS
capabilities, see http://modernizr.com/docs/ fo r more information.
getting modernizr
Just like every other JavaScript library and framework, Modernizr is nothing more than a JavaScript
file that you include within your page. It comes in two different flavors: development (uncompressed)
and production (minified). In most cases, the production version is what you want to use in your
page or application because it is smaller in size, but the development version could prove useful
in certain situations where you need to debug your code along with Modernizr's (you learn about
debugging in Chapter 18).
Modernizr also lets you pick and choose the tests you need to perform in your page or application
(Figure 17-1). For example, if you only use localStorage or native drag and drop in your page, you
can build a customized version of Modernizr that contains only the necessary code for testing the
browser's support for those features.
figure 17-1 
A feature that Modernizr includes by default is a utility called HTML5 Shiv. This utility is only for
legacy versions of IE, and it enables you to style HTML5 elements that are not supported in versions
prior to IE9. If you do not plan to target legacy IE, you can omit HTML5 Shiv in your customized build.
 
Search WWH ::




Custom Search