mirror of
https://github.com/Modernizr/Modernizr.git
synced 2026-01-09 15:47:55 -05:00
Use roundedEquals to test vw and vh units (#2264)
This commit is contained in:
committed by
patrick kettner
parent
0239cb14df
commit
baab13f486
@@ -14,10 +14,11 @@
|
||||
}]
|
||||
}
|
||||
!*/
|
||||
define(['Modernizr', 'testStyles', 'computedStyle'], function(Modernizr, testStyles, computedStyle) {
|
||||
define(['Modernizr', 'testStyles', 'computedStyle', 'roundedEquals'], function(Modernizr, testStyles, computedStyle, roundedEquals) {
|
||||
testStyles('#modernizr { height: 50vh; }', function(elem) {
|
||||
var height = parseInt(window.innerHeight / 2, 10);
|
||||
var compStyle = parseInt(computedStyle(elem, null, 'height'), 10);
|
||||
Modernizr.addTest('cssvhunit', compStyle == height);
|
||||
|
||||
Modernizr.addTest('cssvhunit', roundedEquals(compStyle, height));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
}]
|
||||
}
|
||||
!*/
|
||||
define(['Modernizr', 'testStyles', 'computedStyle'], function(Modernizr, testStyles, computedStyle) {
|
||||
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', compStyle == width);
|
||||
Modernizr.addTest('cssvwunit', roundedEquals(compStyle, width));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user