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

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 UTC