HTML5 logo

Modernizr, Polyfills, and HTML5 Boilerplate

Who Am I?

Rod Knowlton

Senior Web Application Development Specialist, HCSC

Professional Expert

Before The Future, The Past

It doesn't have to be that way anymore

Browsers stink, so why would you want to sniff them?

Two big problems:

solution: detect features instead

Modernizer Logo

Modernizr: Front-End Development Done Right

Project Lead: Faruk Ateş

Lead Developer: Paul Irish

Modernizer Logo

What it is:

Modernizr is an open-source JavaScript library for feature detection. It provides dynamic loading so you load only the detections you need.

What it isn't:

With the exception of incorporating Remy Sharp's HTML5 Shim script, Modernizr does not fix HTML5 deficiencies in browsers.

Modernizer Logo

Installation

The development version includes all feature detections available in Modernizr. It is uncompressed and fully commented.

For production, use the Custom Modernizr Builder, selecting only the feature detections you actually need. This produces a slimmed down and minified source for you.

Modernizer Logo

How it works

Modernizer Logo

Supported Browsers

Modernizer Logo

Features detected: CSS

Modernizer Logo

Features detected: CSS Continued

Modernizer Logo

Features detected: HTML5

Modernizer Logo

Features detected: HTML5 Continued

Modernizer Logo

Features detected: HTML5 Continued

Modernizer Logo

Features detected: HTML5 Continued

Modernizer Logo

Features detected: Miscellaneous

Modernizer Logo

The HTML Element

Sample CSS

Modernizer Logo

The Modernizr Object

Modernizer Logo

The Undetectables

There are a variety of features and attributes that cannot be detected in a consistent manner across all browsers.

Those that have been identified are listed on the Modernizr wiki Undetectables page, along with workarounds if available.

Modernizer Logo

Resources

Polyfills

What are they?

A polyfill, or shim, uses JavaScript to add a missing API to non-compliant browsers.

There are polyfills available for almost all features detected by Modernizr. They are listed on the Modernizr Wiki.

Don't get carried away with them.

Polyfills

Selected Examples

HTML5 Boilerplate

Best Practices in a Can

HTML5 Boilerplate

normalize.css

normalize.css was developed by Nicolas Gallagher along with Jonathan Neal for use instead of the traditional CSS Reset stylesheet.

HTML5 Boilerplate

Build Script

The build script produces your production-ready site.

HTML5 Boilerplate

Prompt IE6 users to install Chrome Frame!

HTML5 Boilerplate

respond.js

respond.js provides media query support so you can do responsive web design across most browsers, including IE6-8.

Thanks for listening

QR Code of talk link

http://j.mp/nF1gjT

/

#