Well, that's pretty much my whole question. I can see how they check for CSS3-support, trying to fetch style.borderRadius
and such to see if the browser knows what the heck is going on. But since most browsers will let the attribute stay (<input type="date">
), but still not support it fully, I can't understand how 开发者_StackOverflowthey do their magic.
For each input type it's different, mostly: http://github.com/Modernizr/Modernizr/blob/master//modernizr.js#L699-751
I think the inline comments describe the considerations for each, so... I'll direct you there. :)
But the first thing we do is do elem.value = ':)'
and see if that sticks. If it does, then it's an indication the feature isn't in place.
There is an issue with the detection of date, datetime, etc using this method in Chromium 15 and the above test fails. I have updated the code and submitted it here: https://github.com/buzypi/Modernizr/blob/patch-1/modernizr.js and created a pull request here: https://github.com/Modernizr/Modernizr/pull/439
精彩评论