prefer-tbody
What it does
Section titled “What it does”Reports a <tr> that is directly in a <table>.
Why it matters
Section titled “Why it matters”The browser puts it into an implied <tbody>, so the DOM differs from the markup, and a selector such as table > tr never matches.
To fix, write the <tbody>.
Example
Section titled “Example”<!DOCTYPE html><title>x</title><table><tr><td>a</td></tr></table><table><tbody><tr><td>a</td></tr></tbody></table><main></main><main hidden></main>...Configuration
Section titled “Configuration”angular: lint: rules: prefer-tbody: warn # off (default), warn, errorhtml: lint: rules: prefer-tbody: warn # off (default), warn, errorsvelte: lint: rules: prefer-tbody: warn # off (default), warn, errorvue: lint: rules: prefer-tbody: warn # off (default), warn, errorEnabled by the presets: html/html-validate-recommended.
Suppress one line with sudsy-disable-next-line prefer-tbody in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| html-validate | prefer-tbody |
full |