JSFiddle - React, Tailwind, and code Playground
by FWeinb
HTML
<script src="http://modernizr.com/downloads/modernizr-2.5.3.js"></script>
<div class="vw"></div>
CSS
.vw { width: 50vw; height: 10px; background: green; }
JavaScript
Modernizr.addTest("viewportunits", 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;
});
alert(Modernizr.viewportunits);