简体   繁体   English

如何确定由js注入的element.style的来源?

[英]How do I identify source of element.style injected by js?

I am updating a wordpress website for a client so am unfamiliar with the structure of the whole site. 我正在为客户更新wordpress网站,所以不熟悉整个网站的结构。

On the blog page ( http://shoreditchradio.co.uk/blog/ ) , posts are displayed in a wrapper #blogleft, which is defined in the css file as follows: 在博客页面( http://shoreditchradio.co.uk/blog/ )上,帖子显示在包装#blogleft中,该包装在css文件中定义如下:

#blogleft {
  float: left;
width: 580px;
}

however via the inspector I can see that the width is being over-ridden to be 100% 但是通过检查器,我看到宽度被覆盖为100%

element.style {
  width: 100%;
}

My question is - what is the easiest way to determine where this is being injected from? 我的问题是-确定从何处注入的最简单方法是什么? As far as I know it can only be from a javascript file somewhere in the site. 据我所知,它只能来自站点中某个位置的javascript文件。

I have been poking around in the inspector for some time now. 我已经在检查员中闲逛了一段时间。 Is there a simple way to identify the source of an injected inline style like this? 有没有一种简单的方法可以识别像这样注入的内联样式的来源? Any help much appreciated! 任何帮助,不胜感激!

That width:100%; 宽度:100%; is hard coded on the HTML, you can see this by checking the style attribute on the div tag in the HTML. 是在HTML上进行硬编码的,您可以通过检查HTML的div标签上的style属性来查看。

The easiest way for CSS and HTML debugging is by using the developer tools/web inspector tools (integrated in firefox and chrome or by plugin such as Firebug). CSS和HTML调试的最简单方法是使用开发人员工具/ Web检查器工具(集成在firefox和chrome中或通过诸如Firebug之类的插件)。 The element.style CSS selector means it is hard coded on the selected element. element.style CSS选择器意味着它在所选元素上进行了硬编码。

"hard coded", in this case, means it is directly injected through the HTML. 在这种情况下,“硬编码”表示它是通过HTML直接注入的。 Through the developer tools/web inspector tools you should be able to determine the origin of the CSS in question. 通过开发人员工具/ Web检查器工具,您应该能够确定相关CSS的来源。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM