This is true at least in Chrome and Firefox:
Object.keys(getComputedStyle(document.body)).includes("backgroundColor") // => true
Object.keys(getComputedStyle(document.body)).includes("background-color") // => false
yet,
getComputedStyle(document.body)["background-color"] // "rgb(255, 255, 255)"
getComputedStyle(document.body)["backgroundColor"] // "rgb(255, 255, 255)"
So if background-color
is not a key, how can
getComputedStyle(document.body)["background-color"]
show something? I know in jQuery, fontSize
is the same as font-size
, etc, but if it is property value access it is against the rule of how to access the property value of an object. Can any JS object behave like this?