Re: [EXT] validator error is wrong within HTML5

 Philip Taylor (RHBNC) (P.Taylor@rhul.ac.uk) wrote:

> The "id" attribute is not permitted for "style" elements — see
> https://html.spec.whatwg.org/multipage/semantics.html#the-style-element
>

The id attribute is allowed on all elements. On the page about global
attributes, it is not included in the list at the start, but later the page
says:
T“he class, id, and slot attributes may be specified on all HTML elements.”
https://html.spec.whatwg.org/multipage/dom.html#global-attributes

So the attribute is not a problem. The problem is the placement of the
style element. It is allowed inside the head element only. There have been
changes between versions of HTML; see e.g.
https://stackoverflow.com/questions/2830296/using-style-tags-in-the-body-with-other-html
Anyway, the “Living HTML standard” is what the validator uses as the
definition, and it currently allows a style element inside the head element
only.

> When will it be fixed?
>
> When Wordpress / Gutenberg cease generating defective code (or when
> Armageddon occurs, whichever comes first).
>
(or when the Living HTML standard is changed).

Probably WordPress / Gutenberg should just generate a bit more verbose CSS
code, since the point in generating code like that seems to be to avoid
repeating a class selector in CSS rules.

Yucca, https://jkorpela.fi

Received on Thursday, 11 May 2023 09:25:28 UTC