mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-17 23:21:04 +00:00
25 lines
758 B
JavaScript
25 lines
758 B
JavaScript
/*!
|
|
{
|
|
"name": "CSS vw unit",
|
|
"property": "cssvwunit",
|
|
"caniuse": "viewport-units",
|
|
"tags": ["css"],
|
|
"builderAliases": ["css_vwunit"],
|
|
"notes": [{
|
|
"name": "Related Modernizr Issue",
|
|
"href": "https://github.com/Modernizr/Modernizr/issues/572"
|
|
}, {
|
|
"name": "JSFiddle Example",
|
|
"href": "https://jsfiddle.net/FWeinb/etnYC/"
|
|
}]
|
|
}
|
|
!*/
|
|
define(['Modernizr', 'testStyles', 'computedStyle', 'roundedEquals'], function(Modernizr, testStyles, computedStyle, roundedEquals) {
|
|
testStyles('#modernizr { width: 50vw; }', function(elem) {
|
|
var width = parseInt(window.innerWidth / 2, 10);
|
|
var compStyle = parseInt(computedStyle(elem, null, 'width'), 10);
|
|
|
|
Modernizr.addTest('cssvwunit', roundedEquals(compStyle, width));
|
|
});
|
|
});
|