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

Function locateClosingAnchor

packages/runtime-core/src/hydration.ts:748–768  ·  view source on GitHub ↗
(
    node: Node | null,
    open = '[',
    close = ']',
  )

Source from the content-addressed store, hash-verified

746
747 // looks ahead for a start and closing comment node
748 const locateClosingAnchor = (
749 node: Node | null,
750 open = '[',
751 close = ']',
752 ): Node | null => {
753 let match = 0
754 while (node) {
755 node = nextSibling(node)
756 if (node && isComment(node)) {
757 if (node.data === open) match++
758 if (node.data === close) {
759 if (match === 0) {
760 return nextSibling(node)
761 } else {
762 match--
763 }
764 }
765 }
766 }
767 return node
768 }
769
770 const replaceNode = (
771 newNode: Node,

Callers 2

hydrateNodeFunction · 0.85
handleMismatchFunction · 0.85

Calls 2

nextSiblingFunction · 0.85
isCommentFunction · 0.70

Tested by

no test coverage detected