From bc50514731de70c6714caab4f34fdb4bfc65425f Mon Sep 17 00:00:00 2001 From: Leo Horie Date: Tue, 17 Jun 2014 22:49:07 -0400 Subject: [PATCH] fix parent tag association across array --- mithril.js | 2 +- tests/mithril-tests.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/mithril.js b/mithril.js index d4c8de1f..35dec667 100644 --- a/mithril.js +++ b/mithril.js @@ -97,7 +97,7 @@ Mithril = m = new function app(window) { } for (var i = 0, cacheCount = 0; i < data.length; i++) { - var item = build(parentElement, null, cached, index, data[i], cached[cacheCount], shouldReattach, index + subArrayCount || subArrayCount, editable, namespace, configs) + var item = build(parentElement, parentTag, cached, index, data[i], cached[cacheCount], shouldReattach, index + subArrayCount || subArrayCount, editable, namespace, configs) if (item === undefined) continue if (!item.nodes.intact) intact = false subArrayCount += item instanceof Array ? item.length : 1 diff --git a/tests/mithril-tests.js b/tests/mithril-tests.js index a11f60a9..73ac1326 100644 --- a/tests/mithril-tests.js +++ b/tests/mithril-tests.js @@ -570,6 +570,13 @@ function testMithril(mock) { m.render(root, m("div", {contenteditable: false}, "test2")) return root.childNodes[0].childNodes[0].nodeValue === "test2" }) + test(function() { + //https://github.com/lhorie/mithril.js/issues/136 + var root = mock.document.createElement("div") + m.render(root, m("textarea", ["test"])) + m.render(root, m("textarea", ["test1"])) + return root.childNodes[0].value === "test1" + }) //end m.render //m.redraw