From 27938534267d81d3b2b5c8d876caacb7f8729076 Mon Sep 17 00:00:00 2001 From: Igor Kurganov Date: Mon, 29 Feb 2016 15:29:08 -0800 Subject: [PATCH] rebased & fixed the issue in the reverted code base. --- mithril.js | 1 + test/mithril.trust.js | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/mithril.js b/mithril.js index 7bf4a399..298b8bb8 100644 --- a/mithril.js +++ b/mithril.js @@ -507,6 +507,7 @@ } else if (editable) { // contenteditable nodes use `innerHTML` instead of `nodeValue`. editable.innerHTML = data + nodes = [].slice.call(editable.childNodes) } else { // was a trusted string if (nodes[0].nodeType === 1 || nodes.length > 1 || diff --git a/test/mithril.trust.js b/test/mithril.trust.js index 015cd318..48e22fa4 100644 --- a/test/mithril.trust.js +++ b/test/mithril.trust.js @@ -64,5 +64,18 @@ describe("m.trust()", function () { expect(root.innerHTML).to.equal("

©

©

©
") }) + // not sure that this goes here; not really an m.trust issue + it("caches children of editable on update", function () { + var root = document.createElement("table") + var t1 = m.trust("

fo

o") + var t2 = "foo" + + m.render(root, m("span", {contenteditable: false}, t1)) + m.render(root, m("span", {contenteditable: true}, t2)) + m.render(root, m("span", {contenteditable: false}, t1)) + + expect(root.childNodes[0].innerHTML).to.equal(t1.valueOf()) + }) + }) })