#380 empty value attr in option should show up
This commit is contained in:
parent
d05b903024
commit
e453ec7ce3
2 changed files with 7 additions and 2 deletions
|
|
@ -346,7 +346,7 @@ var m = (function app(window, undefined) {
|
|||
//- when using CSS selectors (e.g. `m("[style='']")`), style is used as a string, but it's an object in js
|
||||
else if (attrName in node && !(attrName === "list" || attrName === "style" || attrName === "form" || attrName === "type")) {
|
||||
//#348 don't set the value if not needed otherwise cursor placement breaks in Chrome
|
||||
if (node[attrName] !== dataAttr) node[attrName] = dataAttr
|
||||
if (attrName != "input" || node[attrName] !== dataAttr) node[attrName] = dataAttr
|
||||
}
|
||||
else node.setAttribute(attrName, dataAttr)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -409,8 +409,13 @@ test("mixing trusted content w/ td", function() {
|
|||
equal(dummyEl.childNodes[1].nodeName, "I")
|
||||
})
|
||||
|
||||
test("", function() {
|
||||
test("0 should not be treated as empty string", function() {
|
||||
m.render(dummyEl, m("input", {value: ""}))
|
||||
m.render(dummyEl, m("input", {value: 0}))
|
||||
equal(dummyEl.childNodes[0].value, "0")
|
||||
})
|
||||
|
||||
test("empty value in <option> should show as attribute", function() {
|
||||
m.render(dummyEl, m("select", m("option", {value: ""}, "aaa")))
|
||||
equal(dummyEl.childNodes[0].innerHTML, '<option value="">aaa</option>')
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue