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

Re: noscript and script without a line return

From: Tig <tigger@lvlworld.com>
Date: Tue, 5 Sep 2006 22:37:26 +1000
To: David Dorward <david@dorward.me.uk>
Cc: www-validator@w3.org
Message-ID: <20060905123726.GA4333@lvlworld.com>

On Mon, Sep 04, 2006 at 03:22:47PM +0100, David Dorward wrote:
> On Sun, Sep 03, 2006 at 12:27:43AM +1000, Tigger wrote:
> > I believe the validator is wrong with the following XHTML
> > 
> > This is invalid (NOTE: may be wraped, was all one line):
> > <script language="javascript" type="text/javascript">document.write('<a
> > href="#" onclick="thumbs(); return false;">Doom 3 engine</a>');</script>
> 
> The validator is not wrong.
> 
>   "In XHTML, the script and style elements are declared as having
>   #PCDATA content. As a result, < and & will be treated as the start
>   of markup"
>     -- http://www.w3.org/TR/xhtml1/#h-4.8
>  
> > However, this is valid:
> > <script language="javascript" type="text/javascript">
> > <!--
> > document.write('<a href="#" onclick="thumbs(); return false;">Doom 3
> > engine</a>');
> > // -->
> > </script>
> 
> Yes, you've commented it out. If your client was treating your XHTML
> as XML instead of broken HTML it would be entirely ignored.
> 
> > Also, this is invalid, however I can't work out why:
> > <noscript><a href="/shots.php?e=d3">Doom 3 engine</a></noscript>
> 
>    <!ELEMENT NOSCRIPT - - (%block;)+
>        -- http://www.w3.org/TR/html4/interact/scripts.html#h-18.3.1
> 
> The element can contain only block level children. <a> is inline.
> 
> -- 
> David Dorward                                      http://dorward.me.uk
> 


Thank you for your reply. I've now change the XHTML samples above to the
following, which now validate.

<script language="javascript" type="text/javascript">
//<![CDATA[
document.write('<a href="#" onclick="thumbs(); return false;">Doom 3 engine</a>');
//]]>
</script>

and

<noscript><span class="tDate"><a href="/shots.php?e=d3">Doom 3 engine</a></span></noscript>

But is that correct? Including //<![CDATA[  and //]]> seems like a hack
to get around the validator. Placing a <span> between the noscripts tags
makes sense as noscript is a block element and I did have a span tag on
the 'outside' before.

-Tig
Received on Tuesday, 5 September 2006 12:32:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:22 GMT