remunit.js 858 B

12345678910111213141516171819202122232425262728293031
  1. /*!
  2. {
  3. "name": "CSS Font rem Units",
  4. "caniuse": "rem",
  5. "authors": ["nsfmc"],
  6. "property": "cssremunit",
  7. "tags": ["css"],
  8. "builderAliases": ["css_remunit"],
  9. "notes": [{
  10. "name": "W3C Spec",
  11. "href": "https://www.w3.org/TR/css3-values/#relative0"
  12. },{
  13. "name": "Font Size with rem by Jonathan Snook",
  14. "href": "https://snook.ca/archives/html_and_css/font-size-with-rem"
  15. }]
  16. }
  17. !*/
  18. define(['Modernizr', 'createElement'], function(Modernizr, createElement) {
  19. // "The 'rem' unit ('root em') is relative to the computed
  20. // value of the 'font-size' value of the root element."
  21. // you can test by checking if the prop was ditched
  22. Modernizr.addTest('cssremunit', function() {
  23. var style = createElement('a').style;
  24. try {
  25. style.fontSize = '3rem';
  26. }
  27. catch (e) {}
  28. return (/rem/).test(style.fontSize);
  29. });
  30. });