简体   繁体   English

动态添加的样式表未显示在IE Developer Tools中

[英]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.

相关问题 并非所有样式表都显示在开发人员工具(Firefox)中 - Not all stylesheet show up in developer tools (Firefox) 动态添加的样式表标记在IE下不生效 - Dynamically-added stylesheet markup does not take effect under IE 共享的样式表存在导航尺寸在不同视图中明显改变但在开发人员工具(chrome)中显示相同大小的问题 - Shared stylesheet is having issues with nav dimensions visibly changing in different views but showing same size in developer tools (chrome) 在 React 应用程序中,iframe 出现在开发人员工具、元素中 - In React app, iframe is showing up in developer tools, elements Chrome开发者工具 - (索引)样式表在哪里? - Chrome Developer Tools - Where is the (index) stylesheet? 动态加载样式表以在IE中打印 - Dynamically loading stylesheet for print in IE Google Chrome开发人员工具中的“用户样式表”是什么? - What is “User stylesheet” in Google Chrome's developer tools? 如何在Internet Explorer开发人员工具中更改默认样式表规则顺序 - How to change default stylesheet rules order in Internet Explorer Developer Tools Chrome开发者工具&gt;用户代理样式表覆盖<strong>, 规则</strong> - Chrome developer tools > user-agent stylesheet overrides <strong>, <b> rules IE 11 开发者工具:检查 CSS :focus - IE 11 Developer Tools: Inspect CSS :focus
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM