如何在 Internet Explorer 中正确使用 CSSStyleSheet.insertRule()?
How to use CSSStyleSheet.insertRule() in Internet Explorer properly?
我在使用此代码的 Internet Explorer 11 中遇到 "IndexSizeError" 错误:
var style = document.createElement('style');
document.head.appendChild(style);
style.sheet.insertRule('td {overflow: visible}');
根据 https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/insertRule 索引参数是可选的。
在 IE11 中,如果我添加索引参数,错误将得到修复:
var style = document.createElement('style');
document.head.appendChild(style);
style.sheet.insertRule('td {overflow: visible}', 0);
相关:
我在使用此代码的 Internet Explorer 11 中遇到 "IndexSizeError" 错误:
var style = document.createElement('style');
document.head.appendChild(style);
style.sheet.insertRule('td {overflow: visible}');
根据 https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet/insertRule 索引参数是可选的。
在 IE11 中,如果我添加索引参数,错误将得到修复:
var style = document.createElement('style');
document.head.appendChild(style);
style.sheet.insertRule('td {overflow: visible}', 0);
相关: