Last active
December 28, 2015 00:19
-
-
Save davidhund/7412624 to your computer and use it in GitHub Desktop.
Cutting the mustard
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Also: look into using
visibilityState
: https://justmarkup.com/log/2015/02/26/cut-the-mustard-revisited/