Skip to content

Commit 5f878eb

Browse files
MichaelWest22botandrose-machine
authored andcommitted
fix edge cases in idMap creation
1 parent eeaca34 commit 5f878eb

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

test/core.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,4 +587,16 @@ describe("Core morphing tests", function () {
587587
`.trim(),
588588
);
589589
});
590+
591+
it("do not build id in new content parent into persistent id set", function () {
592+
let initial = make("<span><div id='a'>Foo</div></span>");
593+
let finalParent = make("<div id='a'><span>Bar</span></div>");
594+
let finalSrc = finalParent.querySelector("span");
595+
596+
Idiomorph.morph(initial, finalSrc, { morphStyle: "outerHTML" });
597+
598+
// have to make sure the id located in the parent of the new content is not
599+
// included in the persistent ID set or it will pantry the id'ed node in error
600+
initial.outerHTML.should.equal("<span>Bar</span>");
601+
});
590602
});

0 commit comments

Comments
 (0)