Handle [class] selector properly

This commit is contained in:
Barney Carroll 2016-11-19 17:44:36 +00:00
parent 63f491db88
commit 6cb9a5cc80

View file

@ -19,7 +19,8 @@ function hyperscript(selector) {
else if (match[3][0] === "[") {
var attrValue = match[6]
if (attrValue) attrValue = attrValue.replace(/\\(["'])/g, "$1").replace(/\\\\/g, "\\")
attributes[match[4]] = attrValue || true
if (match[4] === "class") classes.push(attrValue)
else attributes[match[4]] = attrValue || true
}
}
if (classes.length > 0) attributes.className = classes.join(" ")