css-vwunit.js 522 B

1234567891011121314
  1. // https://github.com/Modernizr/Modernizr/issues/572
  2. // http://jsfiddle.net/FWeinb/etnYC/
  3. Modernizr.addTest('cssvwunit', function(){
  4. var bool;
  5. Modernizr.testStyles("#modernizr { width: 50vw; }", function(elem, rule) {
  6. var width = parseInt(window.innerWidth/2,10),
  7. compStyle = parseInt((window.getComputedStyle ?
  8. getComputedStyle(elem, null) :
  9. elem.currentStyle)["width"],10);
  10. bool= (compStyle == width);
  11. });
  12. return bool;
  13. });