inexorabletash / polyfill

JavaScript Polyfills, Shims and More
Other
1.36k stars 354 forks source link

Arguments in a __cons function #159

Closed gigachel closed 4 years ago

gigachel commented 4 years ago

There is a cons function in Polyfill.js: `function cons(t, a) { return eval('new t(' + a.map(function(_, i) { return 'a[' + i + ']'; }).join(',') + ')'); } It is called when Reflect.construct is defined, and its parameters are passed to __cons. But in case the second argument in Reflect.construct is pseudo-array “arguments” (Reflect.construct(target, arguments)), then in ie11 there will be an error in __cons function:Object doesn't support property or method 'map' It is enough to replacenew t('+a.map(tonew t('+Array.prototype.slice.call(a).map(` for fixing this error.