Itay Grudev
Itay Grudev

Reputation: 7426

Figuring out which JavaScript set a given CSS property

I am debugging a complex Front End HTML GUI and at some point some JavaScript adds a CSS property to an element, which shouldn't be there.

I am looking for a way to see which JavaScript code (in terms of file and line number) amended the given (in this case style) property so I can debug it further.

Since the JS code is enormous searching the code is not practical. I need some way to bind to property change events and see who changed them.

Upvotes: 0

Views: 45

Answers (1)

Mifort
Mifort

Reputation: 267

Right click on html element in Chrome Devtools => Break on => Attributes Modifications. It make code to stop on a point when css property is changed by javascript. If it will stop inside library that changes the css than use the Sorces => Call Stack (at the right) of Devtools toget to the piece of code that calls the library to change css.

Upvotes: 1

Related Questions