IE6 不会承认动态添加内容的新样式含义
我页面的大部分内容都在
中。在某些时候,此内容被包装在
中——这具有各种 CSS 含义,因为有一个样式表已经加载了整个页面以选择器 #_ #ret{}
开头的规则。然而,新的样式含义并未得到承认(我已经与 DOM 检查器进行了检查 - 表面上,内容的样式就好像 DOM 结构未更改一样)。
我从经验中知道 IE 对动态内容和样式表不明确,并且在两者发挥作用时存在许多问题,因此我尝试了各种黑客来强制重绘和重新解释 - 即 document.getElementById('_') .innerHTML += ' ';
,强制重绘 DOM,以及 document.createStyleSheet(urlToAfore提到CSS)
,在 DOM 更改后重新加载样式表。我可以从状态栏和简短的 FOUC 中看到,这两个 hack 确实导致了重新渲染,但仍然好像 CSS 中新级联的显式规则没有任何意义。
我缺少什么?
I have most of my page's content within <div id="ret">
. At some point, this content is wrapped inside a <div id="_">
-- this has all sorts of CSS implications, as there is a stylesheet that has already loaded with the page full of rules beginning with the selector #_ #ret{}
.
However, the new styling implications are not acknowledged (I've checked with the DOM inspector - ostensibly, the contents are styled as if the DOM structure hadn't been changed).
I know from experience that IE is ambiguous with dynamic content and stylesheets, and has numerous issues with the two coming into play, so I tried various hacks to force redraws and re-interpretations - namely document.getElementById('_').innerHTML += ' ';
, to force a redraw of the DOM, and document.createStyleSheet(urlToAforementionedCSS)
, to reload the stylesheet after the DOM has changed. I can see from the status bar and brief FOUCs that both these hacks are indeed causing re-renders, but still it's as if the new cascade's explicit rules in the CSS mean nothing.
What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
IE6 不会读取涉及以字母字符以外的任何内容开头的类或 id 值的选择器。 -、_ 和 0-9 都会被忽略。
IE6 does not read selectors involving class or id values beginning with anything other than an alphabetic character. -, _, and 0-9 all get ignored.