如何测试我的浏览器是否支持新的语义 HTML 5 元素,例如:
<nav>
<footer>
等等?
最佳答案
Dive Into HTML5 > Detecting HTML5 Features :
There are four basic techniques for detecting whether a browser supports a particular feature. From simplest to most complex:
Check if a certain property exists on a global object (such as window or navigator).
Example: testing for geolocation support
Create an element, then check if a certain property exists on that element.
Example: testing for canvas support
Create an element, check if a certain method exists on that element, then call the method and check the value it returns.
Create an element, set a property to a certain value, then check if the property retained its value.
还有,还有
Modernizr, an open source, MIT-licensed JavaScript library that detects support for many HTML5 & CSS3 features.
加上:
Appendix A: The All-In-One Almost-Alphabetical No-Bullshit Guide to Detecting Everything.
关于HTML 5 测试新元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2839272/