Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object.prototype.toString.call([]) returns incorrect result #278

Closed
Rhionin opened this issue Feb 6, 2017 · 1 comment
Closed

Object.prototype.toString.call([]) returns incorrect result #278

Rhionin opened this issue Feb 6, 2017 · 1 comment

Comments

@Rhionin
Copy link

Rhionin commented Feb 6, 2017

The MDN-recommended way to check isArray is:

// Without Core-js
Object.prototype.toString.call([]) === '[object Array]'; // true

Core-js is replacing the array tag to be "Array Iterator" instead of "Array", which is breaking default behaviors which depend on it.

// With Core-js
Object.prototype.toString.call([]) === '[object Array]'; // false
Object.prototype.toString.call([]) === '[object Array Iterator]'; // true

In my case, core-js and CKEditor don't get along because CKEditor isn't even trying to use Array.isArray before using their own polyfill (see here). Note that I'm reporting to CKEditor that they should attempt to use Array.isArray before their polyfill, as that would make these compatible, but I still believe this is a concern as core-js is clobbering a default behavior.

@Rhionin
Copy link
Author

Rhionin commented Feb 14, 2017

Closing this. Turns out it was a combination of core-js and an older version of prototype.js (1.7.0), which is fixed when updating to 1.7.3. Y'all are great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant