Validate permitted parent (element-permitted-parent)

Some elements have restrictions for what parent element they can have. For instance, the parent of <body> element must the <html> element.

This rule does not validate the document root element, e.g. while the <body> element can only have <html> as parent if there is no parent at all it is assumed to be valid usage.

Rule details

Examples of incorrect code for this rule:

    <title>Lorem ipsum</title>
error: <title> element requires a <head> element as parent (element-permitted-parent) at inline:2:6:
  1 | <div>
> 2 |     <title>Lorem ipsum</title>
    |      ^^^^^
  3 | </div>

1 error found.

Examples of correct code for this rule:

    <title>Lorem ipsum</title>

Version history