虽然IE8这种远古的浏览器已经很少人用了,但现实中,难免会有一定要兼容IE8的需求。这种时候,有份指南,也是极好的。
此处应有浏览器市场份额表
样式表
不支持的CSS属性和选择器
IE8不支持所有的CSS3属性/选择器?在使用如下常用属性/选择器时,应当注意:
border-raidus
(PIE)border-shadow
(PIE)border-image
(PIE)多背景
(PIE)linear-gradient
(PIE)background-size
(background-size-polyfill)background-clip
background-origin
:last-child
解决方案:
- 不要用CSS3…
- CSS3 PIE以支持某些的属性
- background-size-polyfill
脚本
不支持的一些对象方法
Object.assign
Object.defineProperty
Object.create
Object.keys
JSON.parse
JSON.stringify
不支持的一些列表方法
Array.indexOf
Array.map
Array.forEach
Array.filter
不支持的一些函数方法
Function.bind
解决方案
- 用
underscore
,lodash
,lazy.js
等库操作对象、列表、函数等 - 引入腻子脚本
es5-shim.js
https://github.com/es-shims/es5-shimes5-sham.js
https://github.com/es-shims/es5-shimjson3.js
https://github.com/bestiejs/json3es6-shim.js
https://github.com/paulmillr/es6-shimes6-sham.js
https://github.com/paulmillr/es6-shimes7-shim.js
https://github.com/es-shims/es7-shim