From f3dd4fce7d3e14b6bb073157a76018b22e0542d6 Mon Sep 17 00:00:00 2001 From: Demian Ferreiro Date: Mon, 13 Jun 2016 03:55:57 -0300 Subject: [PATCH] Fix #1091 set correct select value when options change Always consider the edge case of setting a node is reused, its option children can change, so its value attribute has to be re-assigned after its children have been recreated/updated. --- mithril.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mithril.js b/mithril.js index 9595a439..e0b464cc 100644 --- a/mithril.js +++ b/mithril.js @@ -727,13 +727,6 @@ cached.children.nodes = [] } - // edge case: setting value on 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) { insertNode(parentElement, node, index) }