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

Re: [VE][64] Javascript strings with html code

From: David Dorward <david@dorward.me.uk>
Date: Fri, 4 Jul 2008 10:32:32 +0100
Cc: www-validator@w3.org
Message-Id: <27C15ED7-A751-48B1-9D9A-D11FBBBB2794@dorward.me.uk>
To: ArtPulse <dotmacintosh@gmail.com>


On 4 Jul 2008, at 04:17, ArtPulse wrote:

>
> Error [64]: "document type does not allow element X here"
>
> More precisely:
>
> Line 38, Column 52: document type does not allow element "b" here.
> 	document.getElementById("dAnsDisp").innerHTML = '<b>Vista previa:</ 
> b><br />' + str;
>
> The validator doesn't realizes it's part of a string, in which HTML  
> entities and others do not matter.

Not true. They do matter.

> Is this a "bug"? Or we're not allowed to use HTML code in Javascript  
> strings on XHTML 1.0 Transitional?

http://www.w3.org/TR/xhtml1/#h-4.8

But I bet you're pretending your XHTML is really HTML so

http://www.w3.org/TR/xhtml1/#C_4

and see also http://www.webdevout.net/articles/beware-of-xhtml


-- 
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/
Received on Friday, 4 July 2008 09:33:18 GMT

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