在 Microsoft Edge 中扩展表格行时出现 Javascript 错误

问题描述

我有这个 js 代码可以展开和折叠 html 表格行。它适用于 FirefoxChrome

const id = "item-" + item.split(" ").join("");
const itemRow = document.getElementById(id);
itemRow.classList.toggle("open");

const elems = document.getElementsByClassName(item);

if (itemRow.className.split(" ").indexOf("open") > -1) {
  itemRow.classList.remove("closed");
  [...elems].forEach(e => {
    e.classList.remove("hidden-item");
  });
} else {
  itemRow.classList.add("closed");
  [...elems].forEach(e => {
    e.classList.add("hidden-item")
  });
}

但在 Edge 中,我在第 9 行(forEach)的浏览器控制台中收到“预期功能错误

知道这意味着什么以及如何为 Edge 修复它吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)