Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 1x 1x 1857x 1112x 783x 783x 783x 783x 782x 782x 782x 783x 329x | import { isNodeOfType } from '../../domUtils/isNodeOfType'; /** * @internal */ export function removeUnnecessarySpan(root: Node) { for (let child = root.firstChild; child; ) { if ( isNodeOfType(child, 'ELEMENT_NODE') && child.tagName == 'SPAN' && child.attributes.length == 0 ) { const node = child; let refNode = child.nextSibling; child = child.nextSibling; while (node.lastChild) { const newNode = node.lastChild; root.insertBefore(newNode, refNode); refNode = newNode; } root.removeChild(node); } else { child = child.nextSibling; } } } |