This is an attempt to make a HTML boilerplate that simplifies progressive enhancement.
It operate under the assumption that their are two types of browsers:
- those that support HTML5
- those that don't
By HTML5, I'm not just talking about markup - I'm using the more nebulous definition that includes many JavaScript APIs and CSS selectors associated with modern web applications.
A breif script in the head judges if the browser is worthy. This is based on detection of two modern DOM API's: one for selecting elements, and one for attaching events.
After that, one can use the .html5 class in CSS and the html5 Boolean in JavaScript to target only HTML5 browsers.
The rules of progressive enhancement still apply - a webpage's basic content and functionality should be written using basic code that all browsers can understand, and special features are layered on top of it based on feature detection. This just simplifies the process a bit by passing a swift judgement about a browser's general support of contemporary web standards.
As a bonus, the a snippet at the end gently informs users of IE8 and below about how obsolete their browser is and where they can download a better one. This gives most uninformed users a direct path for accessing the full website in HTML5, while still leaving the basic website open to anyone who does not change their browser.
Demo here - http://tinyurl.com/bb4r9qf