(content: string, start: number, end: number)
| 592 | } |
| 593 | |
| 594 | function onText(content: string, start: number, end: number) { |
| 595 | if (__BROWSER__) { |
| 596 | const tag = stack[0] && stack[0].tag |
| 597 | if (tag !== 'script' && tag !== 'style' && content.includes('&')) { |
| 598 | content = currentOptions.decodeEntities!(content, false) |
| 599 | } |
| 600 | } |
| 601 | const parent = stack[0] || currentRoot |
| 602 | const lastNode = parent.children[parent.children.length - 1] |
| 603 | if (lastNode && lastNode.type === NodeTypes.TEXT) { |
| 604 | // merge |
| 605 | lastNode.content += content |
| 606 | setLocEnd(lastNode.loc, end) |
| 607 | } else { |
| 608 | parent.children.push({ |
| 609 | type: NodeTypes.TEXT, |
| 610 | content, |
| 611 | loc: getLoc(start, end), |
| 612 | }) |
| 613 | } |
| 614 | } |
| 615 | |
| 616 | function onCloseTag(el: ElementNode, end: number, isImplied = false) { |
| 617 | // attach end position |
no test coverage detected