is_tag_valid_with_ancestor() — svelte Function Reference
Architecture documentation for the is_tag_valid_with_ancestor() function in html-tree-validation.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD f7866d2b_dae9_12da_76a2_8cd373b8b5db["is_tag_valid_with_ancestor()"] 302f84f3_ec7c_fd57_5b8e_e2f3ec2953b7["html-tree-validation.js"] f7866d2b_dae9_12da_76a2_8cd373b8b5db -->|defined in| 302f84f3_ec7c_fd57_5b8e_e2f3ec2953b7 874d992f_5e60_ebce_f4ce_ea5fed014bc4["RegularElement()"] 874d992f_5e60_ebce_f4ce_ea5fed014bc4 -->|calls| f7866d2b_dae9_12da_76a2_8cd373b8b5db 5e189954_74f0_0aa0_89f7_83b3ae199b34["push_element()"] 5e189954_74f0_0aa0_89f7_83b3ae199b34 -->|calls| f7866d2b_dae9_12da_76a2_8cd373b8b5db style f7866d2b_dae9_12da_76a2_8cd373b8b5db fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/html-tree-validation.js lines 144–173
export function is_tag_valid_with_ancestor(child_tag, ancestors, child_loc, ancestor_loc) {
if (child_tag.includes('-')) return null; // custom elements can be anything
const ancestor_tag = ancestors[ancestors.length - 1];
const disallowed = disallowed_children[ancestor_tag];
if (!disallowed) return null;
if ('reset_by' in disallowed && disallowed.reset_by) {
for (let i = ancestors.length - 2; i >= 0; i--) {
const ancestor = ancestors[i];
if (ancestor.includes('-')) return null; // custom elements can be anything
// A reset means that forbidden descendants are allowed again
if (disallowed.reset_by.includes(ancestors[i])) {
return null;
}
}
}
if ('descendant' in disallowed && disallowed.descendant.includes(child_tag)) {
const child = child_loc ? `\`<${child_tag}>\` (${child_loc})` : `\`<${child_tag}>\``;
const ancestor = ancestor_loc
? `\`<${ancestor_tag}>\` (${ancestor_loc})`
: `\`<${ancestor_tag}>\``;
return `${child} cannot be a descendant of ${ancestor}`;
}
return null;
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does is_tag_valid_with_ancestor() do?
is_tag_valid_with_ancestor() is a function in the svelte codebase, defined in packages/svelte/src/html-tree-validation.js.
Where is is_tag_valid_with_ancestor() defined?
is_tag_valid_with_ancestor() is defined in packages/svelte/src/html-tree-validation.js at line 144.
What calls is_tag_valid_with_ancestor()?
is_tag_valid_with_ancestor() is called by 2 function(s): RegularElement, push_element.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free