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

Re: The SCRIPT element

From: David Dorward <david@dorward.me.uk>
Date: Wed, 16 Jul 2008 17:33:31 +0100
Message-Id: <4FBE3F83-B0F0-4277-811C-F814A73D7668@dorward.me.uk>
To: www-style@w3.org

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 16:34:22 GMT

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