Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/idiomorph.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
*
Expand Down
8 changes: 8 additions & 0 deletions test/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ describe("Core morphing tests", function(){
initial.outerHTML.should.equal("<div></div>");
});

it('can morph a template tag properly', function()
{
let initial = make("<template data-old>Foo</template>");
let final = make("<template data-new>Bar</template>");
Idiomorph.morph(initial, final);
initial.outerHTML.should.equal(final.outerHTML);
});

it('ignores active element when ignoreActive set to true', function()
{
let initialSource = "<div><div id='d1'>Foo</div><input id='i1'></div>";
Expand Down