[英]Dynamically added stylesheet not showing up in IE Developer Tools
I'm working on a cross-browser bookmarklet where I need to inject my own style sheet into the page as well as various divs, etc. I've got it working everywhere but IE so am now attempting to debug some of the styling issues there. 我正在开发一个跨浏览器的书签,我需要将自己的样式表注入页面以及各种div等。我已经让它在任何地方工作,但IE现在正试图调试一些样式问题那里。
I'm adding my css to the document after a user clicks my bookmarklet as follows: 我在用户点击我的书签后将我的css添加到文档中,如下所示:
if (document.createStyleSheet){
document.createStyleSheet("http://mydomain.com/css/mystyle.css");
} else {
$('head').append('<link rel="stylesheet" href="http://mydomain.com/css/mystyle.css" type="text/css" />');
}
The file is being fetched and applied to divs, etc. I create on the page, however when I inspect the element in IE 9 Developer Tools it does not show me ANY properties from the stylesheet I added dynamically, only those in the style="{}" attr. 该文件正在被提取并应用于div等我在页面上创建,但是当我在IE 9开发人员工具中检查元素时,它没有向我显示动态添加的样式表中的任何属性,只有那些在style =“ {}“attr。
Also, mystyle.css does not show up in the dropdown on the CSS tab, yet it does have a corresponding element in the head and styles in it are being applied to the dom correctly. 此外,mystyle.css没有出现在CSS选项卡的下拉列表中,但它在头部确实有一个相应的元素,并且其中的样式正确地应用于dom。
Any thoughts on how to force the dev tools to recognize my new sheet? 有关如何强制开发工具识别我的新工作表的任何想法? It is infuriating to attempt to debug css w/o being able to manipulate it in-browser directly. 试图调试没有能够直接在浏览器中操作它的css是令人生气的。
Did you click the refresh button in developer tools? 您是否单击了开发人员工具中的刷新按钮? It doesn't refresh the page, it reloads the dom from the current page. 它不刷新页面,它从当前页面重新加载dom。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.