Re: noscript and script without a line return

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

Received on Monday, 4 September 2006 14:23:06 UTC