W3C home > Mailing lists > Public > www-validator-cvs@w3.org > September 2013

[Bug 23157] XHTML: validator doesn’t check that Raw Text elements (style/script) match the constraints

From: <bugzilla@jessica.w3.org>
Date: Wed, 04 Sep 2013 22:49:39 +0000
To: www-validator-cvs@w3.org
Message-ID: <bug-23157-169-m3ObQWlNRh@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=23157

Michael[tm] Smith <mike@w3.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Michael[tm] Smith <mike@w3.org> ---
(In reply to comment #0)

> However, for <script> and <style>, the story is different: Irrespective of
> HTML or XHTML, the validator will use the rules of HTML parsing

That's not true. The reason for the behavior you're seeing is not due to the
validator using the "rules of HTML parsing" to parse <script> and <style> in
XHTML documents. If the documents are served with an XML MIME type, the
validator is using the XML parser to parse them, exactly as you'd expect.

> and stamp the following as valid:
> 
>    <script><FOO/></script>

In an XHTML document, that markup above results in a DOM with an empty element
named FOO as a child of that script element. There's nothing in the spec that
disallows XHTML documents from having arbitrary elements as children of
<script>. So in XHTML, <script><FOO/></script> is actually valid.

> Per the XML parser, the above <FOO> is an element.

Yep

> Thus: not text.

Yep

> Whereas
> the content model of <script> and <style> is (some flavour of) text.

Actually, the spec doesn't say that the content model of <script> and <style>
is text. In a text/html document it is necessarily text, because that's how
it's parsed into the DOM. But the spec doesn't say that it must be text in an
XML document. It just says, "If there is no src attribute, depends on the value
of the type attribute, but must match script content restrictions."

In some XML/XHTML documents, it's imaginable that the contents of the script
element might actually be in some XML language. Maybe even XSLT or XQuery or
something. Or maybe not those but anyway, it can be element content. The spec
has it that way by design.

> Hence,
> the above ought to be stamped as invalid, measured as XHTML against the HTML5
> specification.

No, <script><FOO/></script> is not invalid per the current HTML spec.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Wednesday, 4 September 2013 22:49:40 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:55 UTC