diff --git a/src/blot/abstract/parent.ts b/src/blot/abstract/parent.ts index f94f283..03dbdb2 100644 --- a/src/blot/abstract/parent.ts +++ b/src/blot/abstract/parent.ts @@ -361,7 +361,7 @@ class ParentBlot extends ShadowBlot implements Parent { }); addedNodes .filter((node) => { - return node.parentNode === this.domNode || node === this.uiNode; + return node.parentNode === this.domNode && node !== this.uiNode; }) .sort((a, b) => { if (a === b) { diff --git a/test/unit/parent.js b/test/unit/parent.js index 62f898b..31ba6b9 100644 --- a/test/unit/parent.js +++ b/test/unit/parent.js @@ -81,6 +81,15 @@ describe('Parent', function () { }).not.toThrowError(/\[Parchment\]/); }); + it('ignore added uiNode', function () { + this.scroll.appendChild(this.blot); + this.blot.attachUI(document.createElement('div')); + this.scroll.update(); + expect(this.scroll.domNode.innerHTML).toEqual( + '

0124

', + ); + }); + it('allowedChildren', function () { this.scroll.domNode.innerHTML = '

A

BC

D

'; this.scroll.update();