browsernizr
Version:
Modernizr wrapper for use with browserify
33 lines (30 loc) • 893 B
JavaScript
/*!
{
"name": "CSS Font rem Units",
"caniuse": "rem",
"authors": ["nsfmc"],
"property": "cssremunit",
"tags": ["css"],
"builderAliases": ["css_remunit"],
"notes": [{
"name": "W3C Spec",
"href": "https://www.w3.org/TR/css3-values/#relative0"
},{
"name": "Font Size with rem by Jonathan Snook",
"href": "https://snook.ca/archives/html_and_css/font-size-with-rem"
}]
}
!*/
var Modernizr = require('./../../lib/Modernizr.js');
var createElement = require('./../../lib/createElement.js');
// "The 'rem' unit ('root em') is relative to the computed
// value of the 'font-size' value of the root element."
// you can test by checking if the prop was ditched
Modernizr.addTest('cssremunit', function() {
var style = createElement('a').style;
try {
style.fontSize = '3rem';
}
catch (e) {}
return (/rem/).test(style.fontSize);
});