(nodeImpl, childImpl, suppressObservers)
| 779 | |
| 780 | // https://dom.spec.whatwg.org/#concept-node-insert |
| 781 | _insert(nodeImpl, childImpl, suppressObservers) { |
| 782 | const count = nodeImpl.nodeType === NODE_TYPE.DOCUMENT_FRAGMENT_NODE ? |
| 783 | domSymbolTree.childrenCount(nodeImpl) : |
| 784 | 1; |
| 785 | |
| 786 | if (childImpl) { |
| 787 | const childIndex = domSymbolTree.index(childImpl); |
| 788 | |
| 789 | for (const range of this._liveRanges()) { |
| 790 | const { _start, _end } = range; |
| 791 | |
| 792 | if (_start.offset > childIndex) { |
| 793 | range._setLiveRangeStart(this, _start.offset + count); |
| 794 | } |
| 795 | |
| 796 | if (_end.offset > childIndex) { |
| 797 | range._setLiveRangeEnd(this, _end.offset + count); |
| 798 | } |
| 799 | } |
| 800 | } |
| 801 | |
| 802 | const nodesImpl = nodeImpl.nodeType === NODE_TYPE.DOCUMENT_FRAGMENT_NODE ? |
| 803 | domSymbolTree.childrenToArray(nodeImpl) : |
| 804 | [nodeImpl]; |
| 805 | |
| 806 | if (nodeImpl.nodeType === NODE_TYPE.DOCUMENT_FRAGMENT_NODE) { |
| 807 | let grandChildImpl; |
| 808 | while ((grandChildImpl = domSymbolTree.firstChild(nodeImpl))) { |
| 809 | nodeImpl._remove(grandChildImpl, true); |
| 810 | } |
| 811 | } |
| 812 | |
| 813 | if (nodeImpl.nodeType === NODE_TYPE.DOCUMENT_FRAGMENT_NODE) { |
| 814 | queueTreeMutationRecord(nodeImpl, [], nodesImpl, null, null); |
| 815 | } |
| 816 | |
| 817 | const previousChildImpl = childImpl ? |
| 818 | domSymbolTree.previousSibling(childImpl) : |
| 819 | domSymbolTree.lastChild(this); |
| 820 | |
| 821 | let isConnected; |
| 822 | |
| 823 | for (const node of nodesImpl) { |
| 824 | if (!childImpl) { |
| 825 | domSymbolTree.appendChild(this, node); |
| 826 | } else { |
| 827 | domSymbolTree.insertBefore(childImpl, node); |
| 828 | } |
| 829 | |
| 830 | if ( |
| 831 | (this.nodeType === NODE_TYPE.ELEMENT_NODE && this._shadowRoot !== null) && |
| 832 | (node.nodeType === NODE_TYPE.ELEMENT_NODE || node.nodeType === NODE_TYPE.TEXT_NODE) |
| 833 | ) { |
| 834 | assignSlot(node); |
| 835 | } |
| 836 | |
| 837 | this._modified(); |
| 838 |
no test coverage detected