Modernizr 如何检查对 webforms2.0 中新输入属性的支持?
嗯,这几乎就是我的全部问题。我可以看到他们如何检查 CSS3 支持,尝试获取 style.borderRadius
等,看看浏览器是否知道到底发生了什么。但由于大多数浏览器会让该属性保留(),但仍然不完全支持它,我无法理解他们是如何发挥魔力的。
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 they do their magic.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于每种输入类型,它都是不同的,主要是:
http://github.com/Modernizr/Modernizr/blob/ master//modernizr.js#L699-751
我认为内联注释描述了每个注释的注意事项,所以...我将引导您到达那里。 :)
但我们要做的第一件事是执行
elem.value = ':)'
并看看它是否有效。如果是这样,则表明该功能未到位。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.在 Chromium 15 中使用此方法检测日期、日期时间等存在问题,上述测试失败。我已更新代码并在此处提交: https://github.com /buzypi/Modernizr/blob/patch-1/modernizr.js 并在此处创建拉取请求: https://github.com/Modernizr/Modernizr/pull/439
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