fix: selector [value=""] is mishandled (#1843)
This commit is contained in:
parent
af3da16832
commit
73d9265c6d
2 changed files with 13 additions and 1 deletions
|
|
@ -17,7 +17,7 @@ function compileSelector(selector) {
|
|||
var attrValue = match[6]
|
||||
if (attrValue) attrValue = attrValue.replace(/\\(["'])/g, "$1").replace(/\\\\/g, "\\")
|
||||
if (match[4] === "class") classes.push(attrValue)
|
||||
else attrs[match[4]] = attrValue || true
|
||||
else attrs[match[4]] = attrValue === "" ? attrValue : attrValue || true
|
||||
}
|
||||
}
|
||||
if (classes.length > 0) attrs.className = classes.join(" ")
|
||||
|
|
|
|||
|
|
@ -218,6 +218,18 @@ o.spec("hyperscript", function() {
|
|||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals(true)
|
||||
})
|
||||
o("handles explicit empty string value for input", function() {
|
||||
var vnode = m('input[value=""]')
|
||||
|
||||
o(vnode.tag).equals("input")
|
||||
o(vnode.attrs.value).equals("")
|
||||
})
|
||||
o("handles explicit empty string value for option", function() {
|
||||
var vnode = m('option[value=""]')
|
||||
|
||||
o(vnode.tag).equals("option")
|
||||
o(vnode.attrs.value).equals("")
|
||||
})
|
||||
})
|
||||
o.spec("attrs", function() {
|
||||
o("handles string attr", function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue