Skip to content

Commit

Permalink
Added detection for CSS vw unit. http://jsfiddle.net/FWeinb/etnYC/
Browse files Browse the repository at this point in the history
  • Loading branch information
glsee committed Jul 21, 2012
1 parent 0941909 commit 692f1d3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions feature-detects/css-vwunit.js
@@ -0,0 +1,14 @@
// https://github.com/Modernizr/Modernizr/issues/572
// http://jsfiddle.net/FWeinb/etnYC/
Modernizr.addTest('cssvwunit', function(){
var bool;
Modernizr.testStyles("#modernizr { width: 50vw; }", function(elem, rule) {
var width = parseInt(window.innerWidth/2,10),
compStyle = parseInt((window.getComputedStyle ?
getComputedStyle(elem, null) :
elem.currentStyle)["width"],10);

bool= !!(compStyle == width);
});
return bool;
});

0 comments on commit 692f1d3

Please sign in to comment.