Skip to content

Commit

Permalink
CSS Variables (Custom Properties)
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzzy committed Mar 8, 2018
1 parent c1be5bd commit f3c71b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/index.js
Expand Up @@ -145,7 +145,11 @@ export function app(state, actions, view, container) {
if (name === "key") {
} else if (name === "style") {
for (var i in clone(oldValue, value)) {
element[name][i] = value == null || value[i] == null ? "" : value[i]
if (i[0] === "-") {
element[name].setProperty(i, value)
} else {
element[name][i] = value == null || value[i] == null ? "" : value[i]
}
}
} else {
if (name[0] === "o" && name[1] === "n") {
Expand Down
4 changes: 2 additions & 2 deletions test/dom.test.js
Expand Up @@ -481,11 +481,11 @@ testVdomToHtml("styles", [
html: `<div></div>`
},
{
vdom: <div style={{ color: "red", fontSize: "1em" }} />,
vdom: <div style={{ color: "red", fontSize: "1em", "--foo": "red" }} />,
html: `<div style="color: red; font-size: 1em;"></div>`
},
{
vdom: <div style={{ color: "blue", float: "left" }} />,
vdom: <div style={{ color: "blue", float: "left", "--foo": "blue" }} />,
html: `<div style="color: blue; float: left;"></div>`
},
{
Expand Down

0 comments on commit f3c71b3

Please sign in to comment.