动态加载的 css 不适用于 IE8 中动态加载的 js 视图
我非常担心重复这个问题,而超过一个小时似乎对于寻找答案来说太多了。
情况是:
- Widget,需要动态加载 css
- Sammy.js 和 .ejs 用于视图 - 最重要的是,所有 html 内容都是动态加载
- Lab.js 来加载 javascript
- 加载的样式应该应用于立即出现的所有新内容 的页面
我已经尝试过这些相关帖子的答案
(..和其他)
即使在现代浏览器中,唯一对我有用的是注入内联样式的“样式”节点。但这在 IE8 中不起作用:( 我确实在开发人员工具中看到了样式节点,但它们不适用。我也尝试等到应用样式表后再启动 sammy.js 应用程序。
我真的感谢您的回答或相关问题和工作答案的链接
PS 我现在修复 IE8,但 IE7 工作也在计划中。
I am pretty much worried to make a duplicate with this question while more than on hour seems to be too much for navigating for the answer.
The situation is:
- Widget, which needs to load css dynamically
- Sammy.js and .ejs for views - most of all the html content is loaded dynamically
- Lab.js to load javascripts
- one loaded styles should apply to all the new content which instantly appears on the page
I've already tried the answers from these related posts:
- dynamic CSS loading in IE won't work
- Dynamically changing stylesheet path not working in IE and Firefox
(..and others)
The only thing which works for me even in the modern browsers is the injection of the "style" node with the inline styles inside. But this doesn't work in IE8 :( I do see the style node in the Developer Tools, but they do not apply. I've also tried to wait until the stylesheet is applied before starting the sammy.js application.
I would really appreciate your answer or a link to the related question and working answer.
P.S. I fix IE8 now, but IE7 working is also in the plan.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试使用 createStyleSheet 来代替?
或者您可以提供 IE
styleSheet.cssText
而不是createTextNode
。Did you try using createStyleSheet instead?
Or you could serve IE
styleSheet.cssText
instead ofcreateTextNode
.