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

Function patchStaticNode

packages/runtime-core/src/renderer.ts:552–574  ·  view source on GitHub ↗
(
    n1: VNode,
    n2: VNode,
    container: RendererElement,
    namespace: ElementNamespace,
  )

Source from the content-addressed store, hash-verified

550 * Dev / HMR only
551 */
552 const patchStaticNode = (
553 n1: VNode,
554 n2: VNode,
555 container: RendererElement,
556 namespace: ElementNamespace,
557 ) => {
558 // static nodes are only patched during dev for HMR
559 if (n2.children !== n1.children) {
560 const anchor = hostNextSibling(n1.anchor!)
561 // remove existing
562 removeStaticNode(n1)
563 // insert new
564 ;[n2.el, n2.anchor] = hostInsertStaticContent!(
565 n2.children as string,
566 container,
567 anchor,
568 namespace,
569 )
570 } else {
571 n2.el = n1.el
572 n2.anchor = n1.anchor
573 }
574 }
575
576 const moveStaticNode = (
577 { el, anchor }: VNode,

Callers 1

patchFunction · 0.85

Calls 1

removeStaticNodeFunction · 0.85

Tested by

no test coverage detected