I tested Modernizr and tried to write a test in it to check if the css property is supported in the browser.
Here I wrote for 'overflow-y: auto'
Modernizr.addTest('overflowauto', function(){
var bool = false;
var testProp = "overflow-y";
var testVal = "auto";
var styles = Modernizr._prefixes.join(testProp + ":" + testVal + "; ");
var ret = true;
ret = Modernizr.testStyles('#modernizr { '+styles+' }', function(elem, rule){
for(var i = 0; i < Modernizr._prefixes.length; i++) {
bool = (window.getComputedStyle ?
getComputedStyle(elem, null) :
elem.currentStyle)[Modernizr._prefixes[i] + testProp] == testVal;
if(bool) break;
}
return bool;
});
return ret;
});
If supported, this should set the value of Modernizr.overflowauto to true.
But the fact is that this always returns the truth. :(
even in android <3, where overflow-y: auto is not supported, its return is true. Pls tell me what i am doing wrong or how to achieve what i am trying. Pls help.
source
share