Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<noscript> invalid as direct descendant of <body>? #1694

Open
doriantaylor opened this issue Feb 24, 2024 · 0 comments
Open

<noscript> invalid as direct descendant of <body>? #1694

doriantaylor opened this issue Feb 24, 2024 · 0 comments

Comments

@doriantaylor
Copy link

URL being validated or code to reproduce error:

https://doriantaylor.com/file/see-into-noscript

Error: XHTML element [noscript](https://html.spec.whatwg.org/multipage/#the-noscript-element) not allowed as child of XHTML element [body](https://html.spec.whatwg.org/multipage/#the-body-element) in this context. (Suppressing further errors from this subtree.)

From line 22, column 5; to line 22, column 14

</h1>↩    <noscript>↩     

Of course the error also quotes the spec:

Contexts in which element noscript may be used:
In a head element of an HTML document, if there are no ancestor noscript elements.
Where phrasing content is expected in HTML documents, if there are no ancestor noscript elements.

Content model for element body:
Flow content.

…but the HTML spec also says that the <noscript> element is flow content (in fact it does so directly above that assertion):

4.12.2 The noscript element

Categories:
Metadata content.
Flow content.
Phrasing content.

…and the spec for the body element states the following:

Tag omission in text/html:
A body element's start tag can be omitted if the element is empty, or if the first thing inside the body element is not ASCII whitespace or a comment, except if the first thing inside the body element is a meta, noscript, link, script, style, or template element.
A body element's end tag can be omitted if the body element is not immediately followed by a comment.

…in other words, it acknowledges <noscript> is a valid child element. Either way it appears there is a conflict in the spec; the only question is which direction it's in. My view is that the less constrained reading is correct (i.e. <noscript> is valid as a direct descendant of <body> which is consistent with HTML 4.01 and XHTML 1). I will copy this issue to the WHATWG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant