setProperty() is not working for some rules
pgn-vole opened this issue · 2 comments
pgn-vole commented
Hi,
CSSStyleDeclaration.prototype.setProperty
is not working on properties with hyphen (margin-left, padding-left ect ...)
It is because the the property name passed to setAttribute
must be camel cased.
I noticed the bug on IE8 (real IE8, not a more recent one in IE8 mode)
Test case:
<!DOCTYPE html>
<html>
<body>
<span id="item"> abc </span>
<script>
var item = document.getElementById("item")
item.style.setAttribute('margin-left', '40px') //Not working
item.style.setAttribute('marginLeft', '40px') // Working \o/
</script>
</body>
</html>