summaryrefslogtreecommitdiff
path: root/source/bower_components/modernizr/feature-detects/css-vminunit.js
blob: e6b98813e9e8a5f1e683930e157f93569f3f60c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// https://github.com/Modernizr/Modernizr/issues/572
// http://jsfiddle.net/glsee/JRmdq/8/
Modernizr.addTest('cssvminunit', function(){
    var bool;
    Modernizr.testStyles("#modernizr { width: 50vmin; }", function(elem, rule) {
        var one_vw = window.innerWidth/100,
            one_vh = window.innerHeight/100,
            compWidth = parseInt((window.getComputedStyle ?
                                  getComputedStyle(elem, null) :
                                  elem.currentStyle)['width'],10);
        bool = ( parseInt(Math.min(one_vw, one_vh)*50,10) == compWidth );
    });
    return bool;
});