Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS Variables (Custom Properties) 馃拝 #612

Merged
merged 1 commit into from Mar 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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