Style Behavior Difference Between Webkit And Gecko
I was working on a web application when I noticed some peculiar behavior. I have an element with styles applied via the JavaScript style property. Afterwards, I tried to remove all
Solution 1:
Could it depend on how you set the attribute?
var test=document.getElementById("test");
//test.style.background="green";
test.setAttribute("style", "background: green");
test.removeAttribute("style");
I comment out the second line, because it is a different way of changing that particular attribute.
Now the fourth line works correctly in webkit (using google chrome dev channel), and when I comment it out, //test.removeAttribute("style")
, the box remains green from the third line.
Post a Comment for "Style Behavior Difference Between Webkit And Gecko"