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

https://www.w3.org/Bugs/Public/show_bug.cgi?id=23157

Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |xn--mlform-iua@xn--mlform-i
                   |                            |ua.no
         Resolution|INVALID                     |---

--- Comment #2 from Leif Halvard Silli <xn--mlform-iua@xn--mlform-iua.no> ---
(In reply to comment #1)
> (In reply to comment #0)

> Actually, the spec doesn't say that the content model of <script> and
> <style> is text.

You are right. But wrong. Spec says about the content model that it:

“If there is no src attribute, depends on the value of the type attribute, but
must match script content restrictions.”

So, in the default state - which is what I intended by this bug, the content
model is _JavaScript_. And does elements belong inside the JavaScript code? As
much as I know, the answer is "no". I don't think they belong in any scripting
language (except perhaps one that is based on XML - like you mentioned below).

Hence, <script><foo/></script> does break the content type of that particular
<script> element.

Of course, I don’t expect the validator to validate the JavaScript. But I do
expect the validator to understand if there are markup mixed with the code.
Just like the validator can flag a <title> that occurs in the <body>, it can
also flag an <element> that occurs inside a <script> element of type
javascript.

> 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."

Right!

> In some XML/XHTML documents, it's imaginable that the contents of the script
> element might actually be in some XML language

Absolutely. But then the @type atribute must be something other than
"text/javascript".

>. 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.

It seems you are only looking at it froma well-formed kind of perspective, and
I agree that it is well-formed, of course.

But the way I see it, since there is no @type attribute in
<script><FOO/></script>, the content is, by default, javaScript. Hence, it is
not in line with the content model if an element occurs in the midst of the
script.

It might be that you don’t wanna add this feature, but that does not make the
request invalid.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Thursday, 5 September 2013 00:36:02 UTC