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

Function determine_slot

packages/svelte/src/compiler/utils/slot.js:8–20  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

6 * @param {AST.SvelteNode} node
7 */
8export function determine_slot(node) {
9 if (!is_element_node(node)) return null;
10
11 for (const attribute of node.attributes) {
12 if (attribute.type !== 'Attribute') continue;
13 if (attribute.name !== 'slot') continue;
14 if (!is_text_attribute(attribute)) continue;
15
16 return /** @type {string} */ (attribute.value[0].data);
17 }
18
19 return null;
20}

Callers 3

ComponentFunction · 0.90
build_componentFunction · 0.90
visit_componentFunction · 0.90

Calls 2

is_element_nodeFunction · 0.90
is_text_attributeFunction · 0.90

Tested by

no test coverage detected