rebased & fixed the issue in the reverted code base.

This commit is contained in:
Igor Kurganov 2016-02-29 15:29:08 -08:00
parent f17658e2d3
commit 2793853426
2 changed files with 14 additions and 0 deletions

View file

@ -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 ||

View file

@ -64,5 +64,18 @@ describe("m.trust()", function () {
expect(root.innerHTML).to.equal("<div><p>&amp;copy;</p><p>©</p>©</div>")
})
// 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("<h1>fo</h1>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())
})
})
})