I find it more intuitive if we'd rename the css key to style — or at least allow both of them — to set the element's inline style. It's closer to the actual HTML attribute.
Sometimes there's a need to set multiple data-attributes when creating a new element. For this I'd prefer to pass in an data object where as each key will be directly set - the same way css is treated.
let element = createElement("div", {
// old
css: {
"background-color": "red",
width: 50,
height: 50,
},
// new! - doesn't work (yet?)
style: {
"..."
}
});
I find it more intuitive if we'd rename the
css
key tostyle
— or at least allow both of them — to set the element's inline style. It's closer to the actual HTML attribute.Sometimes there's a need to set multiple
data
-attributes when creating a new element. For this I'd prefer to pass in andata
object where as each key will be directly set - the same waycss
is treated.