MCPcopy
hub / github.com/sveltejs/svelte / skip_nodes

Function skip_nodes

packages/svelte/src/internal/client/dom/hydration.js:87–112  ·  view source on GitHub ↗
(remove = true)

Source from the content-addressed store, hash-verified

85 * @param {boolean} remove
86 */
87export function skip_nodes(remove = true) {
88 var depth = 0;
89 var node = hydrate_node;
90
91 while (true) {
92 if (node.nodeType === COMMENT_NODE) {
93 var data = /** @type {Comment} */ (node).data;
94
95 if (data === HYDRATION_END) {
96 if (depth === 0) return node;
97 depth -= 1;
98 } else if (
99 data === HYDRATION_START ||
100 data === HYDRATION_START_ELSE ||
101 // "[1", "[2", etc. for if blocks
102 (data[0] === '[' && !isNaN(Number(data.slice(1))))
103 ) {
104 depth += 1;
105 }
106 }
107
108 var next = /** @type {TemplateNode} */ (get_next_sibling(node));
109 if (remove) node.remove();
110 node = next;
111 }
112}
113
114/**
115 *

Callers 6

eachFunction · 0.90
await_blockFunction · 0.90
asyncFunction · 0.90
componentFunction · 0.90
update_branchFunction · 0.90
#handle_errorMethod · 0.90

Calls 1

get_next_siblingFunction · 0.90

Tested by

no test coverage detected