I have an element that's getting styles applied via JavaScript. I'm not sure exactly where; is there a way to check Firebug to show where the "element.style" is actually coming from?
+1
A:
You can open the script view and search for ".style" in the searchbox.
Felix Kling
2010-08-03 22:52:16
That will only work in a very limited number of cases -- especially with jQuery in use.
Brock Adams
2010-08-04 02:09:21
@Brock Adams: That's true, but one can also search for `.css` ;)
Felix Kling
2010-08-04 08:22:52
+5
A:
If you're sure it's being set on the inline style
and not as a consequence of a stylesheet rule, you can detect changes using the non-standard Mozilla watch() method:
document.body.style.watch('color', function(name, v0, v1) {
alert(name+': '+v0+'->'+v1);
});
document.body.style.color= 'red';
You can put debugger;
in the watcher function and look up the call stack in Firebug to see where the change was triggered.
bobince
2010-08-03 23:15:27
+1
A:
You can also right click on the element in the HTML panel before the style is set and select break on Attribute Change. Script panel must be enabled.
johnjbarton
2010-08-04 17:43:22