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", {
// works
"data-a": "a",
// new! doesn't work (yet?)
data: {
b: "b",
c: "c",
}
});
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.