Re: Request for explanation: "the main element must not appear as a descendant of the td element" error message.

On 30 Jan 2019, at 19:06, Jean-Pierre GAY wrote:

> I've got this error message: "the main element must not appear as a 
> descendant of the td element".

> However, nothing in the HTML specification indicates that " the main 
> element must not appear as a descendant of the td element": Content 
> model for td is flow content and parent content model expected for 
> main is also flow content (except for article, aside, footer, header 
> and nav). So, what is the meaning of this error message?

*Start stream of thought*

It looks like this is caused by this change: 
https://github.com/validator/validator/commit/8024cd861c666890795b897d42c457666b598cb5

This does appear to contradict the HTML 5.2 specification: 
https://www.w3.org/TR/html5/grouping-content.html#the-main-element

The WHAT WG spec says: 
https://html.spec.whatwg.org/multipage/grouping-content.html#the-main-element

> Contexts in which this element can be used:
>
> Where flow content is expected, but only if it is a hierarchically 
> correct main element.

and: 
https://html.spec.whatwg.org/multipage/grouping-content.html#hierarchically-correct-main-element

> A hierarchically correct main element is one whose ancestor elements 
> are limited to html, body, div, form without an accessible name, and 
> autonomous custom elements. Each main element must be a hierarchically 
> correct main element.

  This agrees with the comment on the change to the validator:

> Allow only `html`, `body`, `div`, `form`, custom elements as `main` 
> ancestor

*End stream of thought*

The validator is comparing to the What WG Living HTML specification, and 
not the HTML 5.2 specification.

I suspect that the HTML 5.2 version is based on an older snapshot of 
What WG Living and it has changed in the meantime.

-- 
David Dorward
http://dorward.co.uk/

Received on Thursday, 31 January 2019 09:15:26 UTC