paulmillr / es6-shim

ECMAScript 6 compatibility shims for legacy JS engines
http://paulmillr.com
MIT License
3.11k stars 389 forks source link

Array#slice bug #322

Closed zloirock closed 9 years ago

zloirock commented 9 years ago

About https://github.com/paulmillr/es6-shim/commit/bdd9804ddede0515b34646959d409c3c7a259e61 / https://github.com/kangax/compat-table/issues/453

By spec, ArraySpeciesCreate shoud create instance arrayLike.constructor / arrayLike.constructor[@@spicies] only if arrayLike is array, see steps 4-7.

Current implementation different from spec and breaks old code - for example, [].slice.call(document.getElementsByTagName('div')) throws error.

ljharb commented 9 years ago

Unpublished v0.27.0 from npm pending this issue.

ljharb commented 9 years ago

After rereading the spec algorithm, I think that perhaps this isn't shimmable. I'm going to revert this for now and revisit it in the future.