Skip to main content

no-disallowed-ancestor

Warns when an element appears as a descendant of an ancestor element its content model explicitly forbids (forbiddenAncestors), according to the HTML Living Standard. It has settings in @markuplint/html-spec.

Whether a child is allowed by the parent's own content model at all is permitted-contents's concern, not this rule's — some elements are additionally forbidden from appearing anywhere further down the tree under a specific ancestor, not just as its direct child.

❌ Examples of incorrect code for this rule

<address>
<div>
<address>Nested address</address>
</div>
</address>

✅ Examples of correct code for this rule

<address>Contact information</address>

Interface

{
"no-disallowed-ancestor": boolean
}

Default Severity

error