Collapses not working on IE11 (Object.keys: argument is not an Object)

偶尔善良 提交于 2019-12-10 16:02:37

问题


Collapsible(to hide and show data) is working fine in other browsers(opera,chrome).But coming to IE onclick(on company as shown in figure) data is showing (expanding) ,Onclick on same tag/button(company) data is not hiding.In console error is showings as Object.keys: argument is not an Object

I found related question Object.keys not working in internet Explorer here but not applicable to my code(didn't help me). Please help me, to solve this?

Thanks in advance.


回答1:


As this is tagged with "bootstrap-4" I'm assuming it's related to this bug in Bootstrap 4.1.0 where all collapsibles were unclosable in IE11.

More specifically, it was line 334 in Bootstraps js/src/collapse.js that was causing the problem. It was changed from
...typeof config === 'object' && config to
...typeof config === 'object' && config ? config : {}

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

The bug was fixed in subsequent versions. I had the same problem in a project recently and updating Bootstrap to version 4.1.1 fixed the problem.
(Update package.json with "bootstrap": "v4.1.1"(or later) and run npm install.)

TL;DR: It's a Bootstrap bug. Update Bootstrap to version 4.1.1 or later.



来源:https://stackoverflow.com/questions/50676321/collapses-not-working-on-ie11-object-keys-argument-is-not-an-object

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!