Fix #1091 set correct select value when options change
Always consider the edge case of setting a <select> value when building an object. When a <select> node is reused, its option children can change, so its value attribute has to be re-assigned after its children have been recreated/updated.
This commit is contained in:
parent
1b36f2b720
commit
f3dd4fce7d
1 changed files with 7 additions and 7 deletions
14
mithril.js
14
mithril.js
|
|
@ -727,13 +727,6 @@
|
||||||
cached.children.nodes = []
|
cached.children.nodes = []
|
||||||
}
|
}
|
||||||
|
|
||||||
// edge case: setting value on <select> doesn't work before children
|
|
||||||
// exist, so set it again after children have been created
|
|
||||||
if (data.tag === "select" && "value" in data.attrs) {
|
|
||||||
setAttributes(node, data.tag, {value: data.attrs.value}, {},
|
|
||||||
namespace)
|
|
||||||
}
|
|
||||||
|
|
||||||
return cached
|
return cached
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -888,6 +881,13 @@
|
||||||
controllers)
|
controllers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// edge case: setting value on <select> doesn't work before children
|
||||||
|
// exist, so set it again after children have been created/updated
|
||||||
|
if (data.tag === "select" && "value" in data.attrs) {
|
||||||
|
setAttributes(node, data.tag, {value: data.attrs.value}, {},
|
||||||
|
namespace)
|
||||||
|
}
|
||||||
|
|
||||||
if (!isNew && shouldReattach === true && node != null) {
|
if (!isNew && shouldReattach === true && node != null) {
|
||||||
insertNode(parentElement, node, index)
|
insertNode(parentElement, node, index)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue