td-has-header
Data cells in large tables must have an associated header
Checks that every <td> in a large, simple (no colspan/rowspan) table has an associated header, via a headers attribute, an implicit column <th> above it, or an implicit row <th> to its left.
Applies to. `<table>` elements with at least 4 rows and at least 4 columns (a "large" table, where implicit row/column header association is useful; small tables are usually self-evident), and with NO `colspan`/`rowspan` anywhere in the table.
Expectation. Every `<td>` has an associated header, via one of:
- a non-empty `headers` attribute (trusted here; whether it resolves to real `<th>` ids is `table-headers-attr-valid`'s concern, not this rule's), OR
- an implicit column header: some `<th>` in the same column, in an earlier row, OR
- an implicit row header: some `<th>` earlier in the same row.
Examples
<table><tr><th></th><th>Q1</th><th>Q2</th><th>Q3</th></tr><tr><th>North</th><td>1</td><td>2</td><td>3</td></tr><tr><th>South</th><td>4</td><td>5</td><td>6</td></tr><tr><th>East</th><td>7</td><td>8</td><td>9</td></tr></table>
Every `<td>` has both an implicit row header (`<th>` earlier in its row) and column header (`<th>` earlier in its column). The 4x4 minimum size isn't optional — this rule is inapplicable to smaller tables.
<table><tr><td>a</td><td>b</td><td>c</td><td>d</td></tr><tr><td>e</td><td>f</td><td>g</td><td>h</td></tr><tr><td>i</td><td>j</td><td>k</td><td>l</td></tr><tr><td>m</td><td>n</td><td>o</td><td>p</td></tr></table>
A 4x4 table with no `<th>` anywhere — no cell has a row, column, or `headers`-attribute association.