shawnbot / aight

JavaScript shims and shams for making IE8-9 behave reasonably

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

setProperty() is not working for some rules

pgn-vole opened this issue · comments

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>

fixed in #49, huzzah!

awesome ! Thanks @shawnbot