W3C home > Mailing lists > Public > www-style@w3.org > July 2008

Re: The SCRIPT element

From: Francois Remy <fremycompany_pub@yahoo.fr>
Date: Wed, 16 Jul 2008 21:22:49 +0200
Message-ID: <A2292F69B97C4119A678A311B5BD817E@FremyCompany1>
To: "David Dorward" <david@dorward.me.uk>, <www-style@w3.org>

So you're confirming my understanding of the question.
But, why the element is rendered with the comment even if I decide to put an 
XHTML doctype ?

Fremy

--------------------------------------------------
From: "David Dorward" <david@dorward.me.uk>
Sent: Wednesday, July 16, 2008 6:33 PM
To: <www-style@w3.org>
Subject: Re: The SCRIPT element

>
> On 16 Jul 2008, at 16:58, Anne van Kesteren wrote:
>> On Wed, 16 Jul 2008 17:55:12 +0200, Francois Remy 
>> <fremycompany_pub@yahoo.fr
>> > wrote:
>>>
>>> If we have <script><!-- --></script> display, we should
>>> see no content in the script (because this is a comment
>>> that's in the script). But in Firefox and Safari, we see
>>> the <!-- --> as plain text. In Opera, after the "fit" button
>>> was pressed, we can see the "<!-- -->".
>>
>> That sounds correct for HTML, since <script> is not parsed like any 
>> other element.
>
>
> In HTML, <script> and <style> are defined as containing CDATA, so <!--  is 
> a string of characters and not the start of a comment (and magic  happens 
> to stop them being interpreted as CSS or JS). There is  something to 
> render here.
>
> In XHTML, <script> and <style> are not defined as containing CDATA, so  a 
> comment is a comment and stops the script from being executed  (assuming 
> the document is not served as text/html). There isn't  something to render 
> here.
>
> -- 
> David Dorward
> http://dorward.me.uk/
> http://blog.dorward.me.uk/
>
>
> 
Received on Wednesday, 16 July 2008 19:23:30 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:10 GMT