Skip to content

Commit

Permalink
Merge pull request #612 from frenzzy/css-properties
Browse files Browse the repository at this point in the history
CSS Variables (Custom Properties) 馃拝
  • Loading branch information
jorgebucaran committed Mar 8, 2018
2 parents 1e47432 + 11d65a5 commit d91e466
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/index.js
Expand Up @@ -145,7 +145,12 @@ 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]
var style = value == null || value[i] == null ? "" : value[i]
if (i[0] === "-") {
element[name].setProperty(i, style)
} else {
element[name][i] = style
}
}
} 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 d91e466

Please sign in to comment.