Schalk Venter
🔧 Front-end Development / 🎨 UI Design / 🌍 Social Good / ❤️ Destigmatising mental illness
background-color: blue;
background-color: aqy8godf857wqe6igrf7i6dsgkv;
background-color: green;
"It's worth re-iterating: it's very rarely a good idea to use user agent sniffing. You can almost always find a better, more broadly compatible way to solve your problem!"
"Feature detection (also feature testing) is a technique used in web development for handling differences between runtime environments (typically web browsers or user agents), by programmatically testing for clues that the environment may or may not offer certain functionality. This information is then used to make the application adapt in some way to suit the environment: to make use of certain APIs, or tailor for
if / and / or / not
Open-source JavaScript polyfill, named Modernizr
Paul Irish from Google and Alex Sexton from Stripe.
Name is super confusing.
<html class="js flexbox flexboxlegacy canvas canvastext webgl no-touch geolocation postmessage websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers applicationcache svg inlinesvg smil svgclippaths">
No longer able to download a base modernizr.js file.
Have to use their wizard to generate custom file.
In response to increasing focus on performance.
/* default */
.generatedcontent input { }
/* 'or' operator */
.csstransforms3d strong, .generatedcontent input { }
/* 'and' operator */
.csstransforms3d.generatedcontent input { }
/* 'not' operator */
.no-generatedcontent input { }
Render blocking, massive impact on page load time
150+ test, but does not cover every property.
return !!(document.createElement('canvas').getContext && document.createElement('canvas').getContext('2d'));
CSS in JS is very contentious.
Careful to not make claim on the validity of CSS in JS.
Regardless interesting to explore how CSS Feature detection might look in a world eaten by JavaScript, or even post-JavaScript world.
Showcases feature detection as a technique, as opposed to a tech specific tool.
By Schalk Venter
How to use feature detection to ensure that styling from the frontiers of front-end development do not break older browsers.
🔧 Front-end Development / 🎨 UI Design / 🌍 Social Good / ❤️ Destigmatising mental illness