diff --git a/src/idiomorph.js b/src/idiomorph.js index 94f038d..a142bd5 100644 --- a/src/idiomorph.js +++ b/src/idiomorph.js @@ -307,6 +307,10 @@ var Idiomorph = (function () { * @returns {void} */ function morphChildren(newParent, oldParent, ctx) { + if (newParent instanceof HTMLTemplateElement && oldParent instanceof HTMLTemplateElement) { + newParent = newParent.content; + oldParent = oldParent.content; + } /** * diff --git a/test/core.js b/test/core.js index b36a5ec..c78d750 100644 --- a/test/core.js +++ b/test/core.js @@ -185,6 +185,14 @@ describe("Core morphing tests", function(){ initial.outerHTML.should.equal("
"); }); + it('can morph a template tag properly', function() + { + let initial = make("Foo"); + let final = make("Bar"); + Idiomorph.morph(initial, final); + initial.outerHTML.should.equal(final.outerHTML); + }); + it('ignores active element when ignoreActive set to true', function() { let initialSource = "