Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/o2team/es5-polyfill
ECMAScript 5 Polyfill for IE-8
https://github.com/o2team/es5-polyfill
polyfill
Last synced: about 2 months ago
JSON representation
ECMAScript 5 Polyfill for IE-8
- Host: GitHub
- URL: https://github.com/o2team/es5-polyfill
- Owner: o2team
- License: mit
- Created: 2017-05-07T16:50:47.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-29T08:08:27.000Z (about 5 years ago)
- Last Synced: 2024-09-20T12:48:14.031Z (3 months ago)
- Topics: polyfill
- Language: JavaScript
- Homepage:
- Size: 51.8 KB
- Stars: 31
- Watchers: 8
- Forks: 14
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ECMAScript 5 Polyfills
## Object
[Object.keys](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys)
[Object.getPrototypeOf](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf)
[Object.getOwnPropertyNames](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames)
[Object.defineProperty](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty) 注意不要给普通对象添加属性时用 `get/set`,慎用
[Object.defineProperties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties) 慎用
[Object.create](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create)
## Array
[Array.isArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray)
[Array.prototype.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
[Array.prototype.every](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every)
[Array.prototype.fill](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill)
[Array.prototype.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
[Array.prototype.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
[Array.prototype.findIndex](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex)
[Array.prototype.indexOf](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf)
[Array.prototype.lastIndexOf](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf)
[Array.prototype.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
[Array.prototype.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
[Array.prototype.reduceRight](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight)
[Array.prototype.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
## Function
[Function.prototype.bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind)
## String
[String.prototype.trim](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim)
## Date
[Date.prototype.now](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now)
[Date.prototype.toISOString](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
## DOM相关
[Document.getElementsByClassName](https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName)
[CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent)
[Element.matches](https://developer.mozilla.org/en/docs/Web/API/Element/matches)
[Element.textContent](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent)
## Element.getBoundingClientRect
弥补了IE中`getBoundingClientRect`取不到width/height的缺憾
## 事件绑定/解绑
IE中也使用`addEventListener`/`removeEventListener`方法进行事件绑定/解绑
## window
### getComputedStyle
为IE增加了此API的Polyfill
### Viewport
获取当前窗口的一些属性已经做了兼容,可以直接使用如下属性来获取
window.innerWidth
window.innerHeight
window.pageXOffset
window.pageYOffset
window.scrollX
window.scrollY