Merge remote-tracking branch 'origin/rewrite' into rewrite
This commit is contained in:
commit
d63cacbe3c
2 changed files with 7 additions and 1 deletions
|
|
@ -19,7 +19,8 @@ function hyperscript(selector) {
|
||||||
else if (match[3][0] === "[") {
|
else if (match[3][0] === "[") {
|
||||||
var attrValue = match[6]
|
var attrValue = match[6]
|
||||||
if (attrValue) attrValue = attrValue.replace(/\\(["'])/g, "$1").replace(/\\\\/g, "\\")
|
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(" ")
|
if (classes.length > 0) attributes.className = classes.join(" ")
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,11 @@ o.spec("hyperscript", function() {
|
||||||
|
|
||||||
o(vnode.attrs.className).equals("a")
|
o(vnode.attrs.className).equals("a")
|
||||||
})
|
})
|
||||||
|
o("handles 'class' as a verbose attribute declaration", function() {
|
||||||
|
var vnode = m("[class=a]")
|
||||||
|
|
||||||
|
o(vnode.attrs.className).equals("a")
|
||||||
|
})
|
||||||
o("handles merging classes w/ class property", function() {
|
o("handles merging classes w/ class property", function() {
|
||||||
var vnode = m(".a", {class: "b"})
|
var vnode = m(".a", {class: "b"})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue