问题
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