MCPcopy
hub / github.com/vuejs/core / onText

Function onText

packages/compiler-core/src/parser.ts:594–614  ·  view source on GitHub ↗
(content: string, start: number, end: number)

Source from the content-addressed store, hash-verified

592}
593
594function 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
616function onCloseTag(el: ElementNode, end: number, isImplied = false) {
617 // attach end position

Callers 4

ontextFunction · 0.85
ontextentityFunction · 0.85
oninterpolationFunction · 0.85
oncdataFunction · 0.85

Calls 3

setLocEndFunction · 0.85
getLocFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected