welsonjs/node_modules/modernizr/feature-detects/css/remunit.js

32 lines
859 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"
}]
}
!*/
define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
// "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);
});
});