fix select.value so that it displays correct option on first render

This commit is contained in:
Leo Horie 2014-06-26 07:27:42 -04:00
parent 661307c02e
commit 6bca818f34
2 changed files with 3 additions and 1 deletions

View file

@ -9,6 +9,7 @@
### Bug Fixes:
- fixed a subtree directive bug that happened in inputs inside loops
- fixed select.value so that the correct option is displayed on first render
---

View file

@ -133,8 +133,9 @@ Mithril = m = new function app(window) {
node = namespace === undefined ? window.document.createElement(data.tag) : window.document.createElementNS(namespace, data.tag)
cached = {
tag: data.tag,
attrs: setAttributes(node, data.tag, data.attrs, {}, namespace),
//process children before attrs so that select.value works correctly
children: data.children !== undefined ? build(node, data.tag, undefined, undefined, data.children, cached.children, true, 0, data.attrs.contenteditable ? node : editable, namespace, configs) : undefined,
attrs: setAttributes(node, data.tag, data.attrs, {}, namespace),
nodes: [node]
}
parentElement.insertBefore(node, parentElement.childNodes[index] || null)