Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine which JavaScript file applied a style?

Tags:

javascript

css

We have a complex RIA. A particular element has a rougue "display:none" attached to it, there is no matching CSS file when viewed in the browser inspector - so assuming a JS file somewhere is applying it dynamically. Is it possible to find out which script added it?

Thanks.

like image 622
Paul Fernihough Avatar asked Jul 24 '26 14:07

Paul Fernihough


1 Answers

  1. Use Firefox and Firebug.
  2. Find the element in the Firebug DOM inspector.
  3. Right click on it
  4. Pick "Break on attribute change"

or

  1. Use Chrome
  2. Find the element in the Chrome Developer tools DOM inspector
  3. Right click on it
  4. Pick Break On… ➡ Attributes Modifications

That will act as if you have a break point at any point in your JS that you have code that changes the attribute. Since element.style.display = "none" gets mapped onto the style attribute, it will trigger for this.

like image 173
Quentin Avatar answered Jul 26 '26 03:07

Quentin