Skip to content

Instantly share code, notes, and snippets.

@davidhund
Last active December 28, 2015 00:19
Show Gist options
  • Save davidhund/7412624 to your computer and use it in GitHub Desktop.
Save davidhund/7412624 to your computer and use it in GitHub Desktop.
Cutting the mustard
// How To Decide Which Browsers are Handles as 'HTML5'
// We should pick/adapt to our personal situation but these are some good starting points...
// Notably: IE8 is _not_ considered 'HTML5 supporting'.
// 1) The BBC original...
// http://responsivenews.co.uk/post/18948466399/cutting-the-mustard
if('querySelector' in document && 'localStorage' in window && 'addEventListener' in window) {
document.documentElement.className += 'js';
// bootstrap the javascript application
}
// 2) One without localStorage but with [].forEach()
// http://gomakethings.com/ditching-jquery-for-vanilla-js/
// .. also check out http://cferdinandi.github.io/buoy/
if ( 'querySelector' in document && 'addEventListener' in window && Array.prototype.forEach ) {
document.documentElement.className += 'js';
// bootstrap the javascript application
}
// Consder adding SVG-as-IMG
// From: http://css-tricks.com/test-support-svg-img/
doesSVGasIMG = document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image", "1.1");
// We _could_ polyfill existing stuff, but pick wisely!
// E.g. Working with classes: http://toddmotto.com/apollo-js-standalone-class-manipulation-api-for-html5-and-legacy-dom/
// Etc..
// BUT: the point of Cutting the Mustard is to Progressivly Enhance: not to Polyfill all the things!
@davidhund
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment