最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Collapses not working on IE11 (Object.keys: argument is not an Object) - Stack Overflow

programmeradmin0浏览0评论

Collapsible(to hide and show data) is working fine in other browsers(opera,chrome).But ing to IE onclick(on pany as shown in figure) data is showing (expanding) ,Onclick on same tag/button(pany) 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).

Collapsible(to hide and show data) is working fine in other browsers(opera,chrome).But ing to IE onclick(on pany as shown in figure) data is showing (expanding) ,Onclick on same tag/button(pany) 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).

Share Improve this question edited Nov 21, 2022 at 8:11 starball 54.1k35 gold badges236 silver badges932 bronze badges asked Jun 4, 2018 at 8:30 Ramlal SRamlal S 1,6531 gold badge17 silver badges36 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 5

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.

发布评论

评论列表(0)

  1. 暂无评论