has_content() — svelte Function Reference
Architecture documentation for the has_content() function in index.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 7cd33d31_694c_80e8_2d52_a5460606f9d7["has_content()"] b389a21f_6de7_2a41_34f3_8efbf9045c9c["index.js"] 7cd33d31_694c_80e8_2d52_a5460606f9d7 -->|defined in| b389a21f_6de7_2a41_34f3_8efbf9045c9c c342967b_b314_8027_476d_d085ed0e13f0["check_element()"] c342967b_b314_8027_476d_d085ed0e13f0 -->|calls| 7cd33d31_694c_80e8_2d52_a5460606f9d7 style 7cd33d31_694c_80e8_2d52_a5460606f9d7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/phases/2-analyze/visitors/shared/a11y/index.js lines 818–851
function has_content(element) {
for (const node of element.fragment.nodes) {
if (node.type === 'Text') {
if (node.data.trim() === '') {
continue;
}
}
if (node.type === 'RegularElement' || node.type === 'SvelteElement') {
if (node.attributes.some((a) => a.type === 'Attribute' && a.name === 'popover')) {
continue;
}
if (
node.name === 'img' &&
node.attributes.some((node) => node.type === 'Attribute' && node.name === 'alt')
) {
return true;
}
if (node.name === 'selectedcontent') {
return true;
}
if (!has_content(node)) {
continue;
}
}
// assume everything else has content — this will result in false positives
// (e.g. an empty `{#if ...}{/if}`) but that's probably fine
return true;
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does has_content() do?
has_content() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/2-analyze/visitors/shared/a11y/index.js.
Where is has_content() defined?
has_content() is defined in packages/svelte/src/compiler/phases/2-analyze/visitors/shared/a11y/index.js at line 818.
What calls has_content()?
has_content() is called by 1 function(s): check_element.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free