element-permitted-occurrences
Angular templatesHTMLVue / SvelteVue / Sveltecorrectnessno fixdefault: offhtml/html-validate-standard
What it does
Section titled “What it does”Reports an element that the parent permits at most once (<head>, <body>, <title>, <caption>) when it appears again. A <script> or <style> after </body> opens an implied <head>, and is reported.
Why it matters
Section titled “Why it matters”The browser keeps the first one and merges or drops the others, so the second <title> has no effect and the content in a second <body> ends up somewhere else.
To fix, remove the repeated element, or merge its content into the first.
Example
Section titled “Example”<!DOCTYPE html><html lang="en"><head><title>x</title><title>y</title></head><body>...Configuration
Section titled “Configuration”angular: lint: rules: element-permitted-occurrences: warn # off (default), warn, errorhtml: lint: rules: element-permitted-occurrences: warn # off (default), warn, errorsvelte: lint: rules: element-permitted-occurrences: warn # off (default), warn, errorvue: lint: rules: element-permitted-occurrences: warn # off (default), warn, errorEnabled by the presets: html/html-validate-standard.
Suppress one line with sudsy-disable-next-line element-permitted-occurrences 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-occurrences |
partial | the content model of html-validate (data/model.txt); elements that no model row names are not judged |