W3C home > Mailing lists > Public > www-validator@w3.org > January 2005

Re: [VE][64] Error Message Feedback

From: Philip TAYLOR <P.Taylor@Rhul.Ac.Uk>
Date: Sun, 30 Jan 2005 17:10:22 +0000
Message-ID: <41FD14FE.4060802@Rhul.Ac.Uk>
To: "Jukka K. Korpela" <jkorpela@cs.tut.fi>
CC: DjMafia <barrerad@gye.satnet.net>, www-validator@w3.org

Jukka K. Korpela wrote:

> On Sun, 30 Jan 2005, DjMafia wrote:
> 
> 
>><script type="text/javascript"> if (!chatterbox || chatterbox != 'ok') {
>>var txt = "This <a href="http://chatter.flooble.com/">flooble
>>chatterbox</a> is"
> 
> 
> Quick answer: put all script code into an external file that you refer to
> via a src attribute in a script element. Alternatively, unless you have
> some particular reason to use XHTML, switch to HTML, where the problem
> is smaller (you only need to worry about things like </a>, which you
> can write as <\/a> in JavaScript).
> 
> In XHTML, which you seem to be using, a script element's content is
> #PCDATA (parsed character data), and hence e.g. "<a" is interpreted as
> starting an element (but no elements are allowed inside a script element).
> 
> In principle, you could replace any occurrence of "<" inside a
> script element by "&lt;". This would be fine as far as XHTML is concerned.
> But this would not be practical, since Internet Explorer does not actually
> "do XHTML" but e.g. interprets the content of a script element by
> classic HTML rules (to the extent it plays by any rules).

Not convinced this is really the cause of the problem; surely it is the
double use of '"' that is the problem -- used first as delimiter
for the var txt assignment, and then again within the RHS of the
assignment to delimit the replacement text for the href.

Philip Taylor
Received on Sunday, 30 January 2005 17:11:36 GMT

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