(
/** @type {InsertionPlace} */ place,
/** @type {HtmlNode} */ node
)
| 4793 | }; |
| 4794 | |
| 4795 | const insertAtPlace = ( |
| 4796 | /** @type {InsertionPlace} */ place, |
| 4797 | /** @type {HtmlNode} */ node |
| 4798 | ) => { |
| 4799 | if (place.beforeNode) { |
| 4800 | const arr = childrenOf(place.parent); |
| 4801 | const idx = arr.indexOf(place.beforeNode); |
| 4802 | if ( |
| 4803 | node.type === NodeType.Text && |
| 4804 | idx > 0 && |
| 4805 | arr[idx - 1].type === NodeType.Text |
| 4806 | ) { |
| 4807 | /** @type {HtmlText} */ (arr[idx - 1]).data += node.data; |
| 4808 | return; |
| 4809 | } |
| 4810 | arr.splice(idx, 0, node); |
| 4811 | } else { |
| 4812 | appendTo(place.parent, node); |
| 4813 | } |
| 4814 | }; |
| 4815 | |
| 4816 | const insertCharacters = ( |
| 4817 | /** @type {string} */ data, |
no test coverage detected