fix textarea value updating

This commit is contained in:
Leo Horie 2014-05-27 22:27:10 -04:00
parent f4effe90ae
commit 061cb168e5
2 changed files with 13 additions and 2 deletions

View file

@ -1,5 +1,14 @@
## Change Log ## Change Log
[v0.1.15](/mithril/archive/v0.1.15) - maintenance
### Bug Fixes:
- `m.sync` now correctly passes arguments to resolver in same order as input arguments [#96](https://github.com/lhorie/mithril.js/issues/96)
- updating textarea attributes updates its value correctly [#100](https://github.com/lhorie/mithril.js/issues/100)
---
[v0.1.14](/mithril/archive/v0.1.14) - maintenance [v0.1.14](/mithril/archive/v0.1.14) - maintenance
### News: ### News:

View file

@ -73,7 +73,7 @@ Mithril = m = new function app(window) {
cached = { cached = {
tag: data.tag, tag: data.tag,
attrs: setAttributes(node, data.tag, data.attrs, {}, namespace), attrs: setAttributes(node, data.tag, data.attrs, {}, namespace),
children: build(node, data.tag, data.children, cached.children, true, 0, data.attrs.contenteditable ? node : editable, namespace), children: data.children !== undefined ? build(node, data.tag, data.children, cached.children, true, 0, data.attrs.contenteditable ? node : editable, namespace) : undefined,
nodes: [node] nodes: [node]
} }
parentElement.insertBefore(node, parentElement.childNodes[index] || null) parentElement.insertBefore(node, parentElement.childNodes[index] || null)
@ -155,7 +155,9 @@ Mithril = m = new function app(window) {
else if (attrName === "value" && tag === "input") { else if (attrName === "value" && tag === "input") {
if (node.value !== dataAttr) node.value = dataAttr if (node.value !== dataAttr) node.value = dataAttr
} }
else if (attrName in node && !(attrName == "list" || attrName == "style")) node[attrName] = dataAttr else if (attrName in node && !(attrName == "list" || attrName == "style")) {
node[attrName] = dataAttr
}
else node.setAttribute(attrName, dataAttr) else node.setAttribute(attrName, dataAttr)
} }
} }