element-permitted-content
What it does
Section titled “What it does”Reports an element that its parent does not permit as content (<li> outside a list, <div> in a <table>, a deprecated element in flow content), and one that an ancestor forbids as a descendant (<a> in <a>, a block element in a <button>).
Why it matters
Section titled “Why it matters”The browser repairs invalid nesting on its own, and the repair moves or splits elements (a <div> in a <table> is moved out). The page then differs from the markup and from what scripts and styles select.
To fix, move the element to a parent that permits it, or use an element that fits.
Example
Section titled “Example”...<html lang="en">...<body><ul><li>a</li><div></div></ul><p><a href="x"><a href="y">z</a></a></p><font>old</font>...<a href="x"><img alt="logo" src="a"></a>...Configuration
Section titled “Configuration”angular: lint: rules: element-permitted-content: warn # off (default), warn, errorhtml: lint: rules: element-permitted-content: warn # off (default), warn, errorsvelte: lint: rules: element-permitted-content: warn # off (default), warn, errorvue: lint: rules: element-permitted-content: warn # off (default), warn, errorEnabled by the presets: html/html-validate-standard.
Suppress one line with sudsy-disable-next-line element-permitted-content in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.
| Tool | Rule | Match | What differs |
|---|---|---|---|
| html-validate | element-permitted-content |
partial | the content model of html-validate (data/model.txt); elements that no model row names are not judged |