Re: span elements in script elements

On 14 May 2008, at 10:39, David Fosberry wrote:
> Whilst validating www.fosberry.com/cgi/GuestBook.pl, I received  
> error 64, about a <span> element “not allowed here“.
>
> I believe this is a bug in the validator.

It isn't.

> The <span> element is included in a literal string in a <script>  
> element, and as such should not be parsed by the HTML validator.

See http://www.w3.org/TR/xhtml1/#h-4.8 while being aware of the  
problems this causes if you serve your XHTML as text/html ( http://www.w3.org/TR/xhtml1/#C_4 
  and http://www.webdevout.net/articles/beware-of-xhtml ).

>  I will of course attempt a work-around, by embedding the JavaScript  
> in HTML comment markers (inside the <script> element), but it really  
> should not be necessary.

User agents treating your code as XHTML will ignore the entire script  
(since it is commented out). XHTML and HTML are different.

-- 
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/

Received on Wednesday, 14 May 2008 14:11:57 UTC