@marknadal's solution wasn't grabbing hyphenated properties for me (e.g. max-width
), but changing the first for
loop in css2json()
made it work, and I suspect performs fewer iterations:
for (var i = 0; i < css.length; i += 1) {
s[css[i]] = css.getPropertyValue(css[i]);
}
Loops via length
rather than in,
retrieves via getPropertyValue()
rather than toLowerCase().