简体   繁体   English

为什么Chrome开发者工具会添加文件中未包含的元素?

[英]Why does Chrome Developer Tool add elements not in the file?

When I have a simple HTML markup like this: 当我有一个像这样的简单HTML标记时:

<!DOCTYPE html>
<html>
    <head>
        <title>lawl</title>
    </head>
    <body>
    </body>
</html>

When viewing the elements of the document, in the Chrome Deceloper Tool(F12) it looks likes this: 查看文档的元素时,在Chrome Deceloper Tool(F12)中看起来像这样:

<!DOCTYPE html>
<html>
    <head>
        <title>lawl</title>
        <style type="text/css"></style> <-- what the?
    </head>
    <body>
    </body>
</html>

So, my question goes: Where does the style tag come from? 因此,我的问题是:样式标签从何而来? What added it, and why? 是什么添加了它,为什么?

Hope you guys can clear this up for us, it's been quite the subject the last 10 minutes in class ;-). 希望你们能为我们解决这个问题,这是课堂上最后10分钟的主题;-)。 Also worth mentioning; 还值得一提; a class got added to a empty div in another document when the teacher tried it. 当老师尝试时,一个班级被添加到另一个文档的空div中。

Edited title. 编辑标题。

Chrome plugins can get access to your DOM, and so does the development tools. Chrome插件可以访问您的DOM,开发工具也可以访问。 In this particular case, I think the development tools is the one to blame. 在这种情况下,我认为应该指责开发工具。

The empty style tag is probably a placeholder for injected CSS. 空样式标签可能是注入CSS的占位符。

If you open the source code ( view-source:www.example.com ), you will see that your DOM is perfectly fine. 如果您打开源代码( view-source:www.example.com ),您将看到DOM非常完美。

99:1 <style>元素是您的AdBlock(或类似名称)扩展程序注入的样式表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么web刮掉HTML与开发者工具元素面板中的HTML不匹配 - Why is the web scraped HTML not matching the HTML in the developer tool Elements Panel 为什么Chrome开发者工具插入HTML? - Why does Chrome Developer Tools insert HTML? chrome开发人员工具源代码 - chrome developer tool source code Chrome 开发者工具没有显示响应 - Chrome Developer Tool is not showing responsiveness 为什么Inspector开发人员工具无法反映所有代码? - Why does Inspector developer tool not reflect all code? 在Chrome检查器开发人员工具(“检查器样式表”)中添加新的空白样式表的最快方法 - Fastest way to add a new blank stylesheet in Chrome's inspector developer tool (“Inspector stylesheet”) 在Chrome中打开开发者控制台后,onmouseover为什么会停止工作? - When the developer console is open in chrome, why does onmouseover stop working? Chrome web 开发者工具更改屏幕分辨率 - Chrome web developer tool changes screen resolutions 在 Chrome 开发者工具中编辑 css 后,css 文件无法加载 - After editing css in Chrome Developer Tools, css file does not load 当我在谷歌浏览器上打开开发人员工具时,为什么我的 css 代码文件有我的 html 源代码? - Why does my css code file have my html source when I open developers tool on google chrome?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM