了解HTML5Shiv的Modernizr好处
-
10-12-2019 - |
解决方案
They do different things.
Modernizr detects the availability of features in a page allowing you to provide your own polyfills for older browsers should you require that functionality. You can add support for <canvas>
using a canvas tag polyfill so that canvas functionality, including it's JavaScript interface, in browsers that don't support the <canvas>
tag.
Html5shiv adds the new html5 tags that aren't available (<section>
, <header>
, etc) to older browsers. It also creates the default styles (display: block
for <section>
for example).
That's it. It provides no other functionality.
其他提示
Modernizr 1.5+ actually includes HTML5Shiv, so if you use it, shiv is redundant. Source: http://modernizr.com/docs/#html5inie
"As of Modernizr 1.5, this script is identical to what is used in the popular html5shim/html5shiv library."