Allow css vars with uppercase characters (#2311)

* Allow css vars with uppercase characters

* Remove charAt

* Extract dash lowercase lambda

* Extract match uppercase regex

* Set key and value correctly in updateStyle

* Fix domMock style to work like the browser
This commit is contained in:
Rasmus Porsager 2018-11-26 15:40:08 +01:00 committed by Isiah Meadows
parent 87033bf1e0
commit 7c299ab48c
3 changed files with 34 additions and 19 deletions

View file

@ -33,6 +33,18 @@ o.spec("createElement", function() {
o(vnode.dom.nodeName).equals("DIV")
o(vnode.dom.style.backgroundColor).equals("red")
})
o("allows css vars in style", function() {
var vnode = {tag: "div", attrs: {style: {"--css-var": "red"}}}
render(root, [vnode])
o(vnode.dom.style["--css-var"]).equals("red")
})
o("allows css vars in style with uppercase letters", function() {
var vnode = {tag: "div", attrs: {style: {"--cssVar": "red"}}}
render(root, [vnode])
o(vnode.dom.style["--cssVar"]).equals("red")
})
o("creates children", function() {
var vnode = {tag: "div", children: [{tag: "a"}, {tag: "b"}]}
render(root, [vnode])