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

Collapses not working on IE11 #26266

Closed
adrigm opened this issue Apr 11, 2018 · 5 comments
Closed

Collapses not working on IE11 #26266

adrigm opened this issue Apr 11, 2018 · 5 comments

Comments

@adrigm
Copy link

adrigm commented Apr 11, 2018

SCRIPT5007: Object.keys: the argument is not an object.

dd

@adrigm adrigm changed the title Collapses no working on IE11 Collapses not working on IE11 Apr 11, 2018
@razh
Copy link
Contributor

razh commented Apr 11, 2018

This is because Babel improved its compliance with spec behavior:

babel/babel#7034

And the _objectSpread helper function uses Object.keys.

https://github.com/babel/babel/blob/v7.0.0-beta.44/packages/babel-helpers/src/helpers.js#L373-L391

To resolve this, loose mode could be used:

https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-object-rest-spread#loose

@Herst
Copy link
Contributor

Herst commented Apr 11, 2018

Is this not what Babel is supposed to prevent? 🙄 I thought the idea was: You just write your code utilizing the newest features and we do the rest to make it work in older browsers or warn you if it is not possible…

Anyway, alternatively users targeting browsers without Object.keys support could be asked to add a shim. What else would need to be shimmed in order to support IE11? Object.assign perhaps? In that case this note would have to be added to the general browser support page and not just the sub pages of the affected features.

@XhmikosR
Copy link
Member

/CC @Johann-S

@razh
Copy link
Contributor

razh commented Apr 12, 2018

Wait a minute, IE 9 and above support Object.keys, but it appears their implementation is the ES5 version.

In ES5, if the argument to this method is not an object (a primitive), then it will cause a TypeError. In ES2015, a non-object argument will be coerced to an object.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys#Notes

This error is occurring because of this line:

...typeof config === 'object' && config

If config is not an object, this is false. In IE, Object.keys(false) results in an error, while modern browsers return [].

@japrogramer
Copy link

IE .. always slowing developers down .. it's just a shame thats all.

@twbs twbs locked and limited conversation to collaborators Oct 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants