Skip to content

Commit 99411e8

Browse files
committed
fix(ie): add NodeList forEach polyfill
1 parent b263107 commit 99411e8

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

js/src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import './polyfill'
12
import $ from 'jquery'
23
import AjaxLoad from './ajax-load'
34
import AsideMenu from './aside-menu'

js/src/polyfill.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* required polyfills
3+
*/
4+
5+
// eslint-disable-next-line consistent-return
6+
(function () {
7+
if (typeof NodeList.prototype.forEach === 'function') {
8+
return false
9+
}
10+
NodeList.prototype.forEach = Array.prototype.forEach
11+
}())
12+
13+
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
14+
// import 'core-js/es6/symbol'
15+
// import 'core-js/es6/object'
16+
// import 'core-js/es6/function'
17+
// import 'core-js/es6/parse-int'
18+
// import 'core-js/es6/parse-float'
19+
// import 'core-js/es6/number'
20+
// import 'core-js/es6/math'
21+
// import 'core-js/es6/string'
22+
// import 'core-js/es6/date'
23+
// import 'core-js/es6/array'
24+
// import 'core-js/es6/regexp'
25+
// import 'core-js/es6/map'
26+
// import 'core-js/es6/weak-map'
27+
// import 'core-js/es6/set'
28+
// import 'core-js/es7/object'
29+
30+
/** IE10 and IE11 requires the following for the Reflect API. */
31+
// import 'core-js/es6/reflect'
32+
33+
/** Evergreen browsers require these. **/
34+
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
35+
// import 'core-js/es7/reflect'
36+
37+
// CustomEvent() constructor functionality in IE9, IE10, IE11
38+
// (function () {
39+
//
40+
// if ( typeof window.CustomEvent === "function" ) return false
41+
//
42+
// function CustomEvent ( event, params ) {
43+
// params = params || { bubbles: false, cancelable: false, detail: undefined }
44+
// var evt = document.createEvent( 'CustomEvent' )
45+
// evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail )
46+
// return evt
47+
// }
48+
//
49+
// CustomEvent.prototype = window.Event.prototype
50+
//
51+
// window.CustomEvent = CustomEvent
52+
// })()

0 commit comments

Comments
 (0)