W3C home > Mailing lists > Public > www-validator@w3.org > May 2006

Re: validator bug?

From: David Dorward <david@dorward.me.uk>
Date: Thu, 18 May 2006 07:36:27 +0100
To: randynichols@yahoo.com
Cc: www-validator@w3.org
Message-Id: <200605180736.28018.david@dorward.me.uk>

On Wednesday 17 May 2006 02:16, Randy Nichols wrote:
> The attached HTML file failed the validator because
> there was an "&" embedded in a single-quoted string
> inside a double-quoted string of JavaScript that was
> the value of an "onClick" attribute of a button.

> It seems to me that no escaping should be necessary
> inside such quoted strings from the HTML validator's
> standpoint.

http://www.w3.org/TR/html4/interact/scripts.html#adef-onclick states that the 
onclick attribute takes a data type of "Script" and links to 
http://www.w3.org/TR/html4/types.html#type-script which states that "cript 
data that is element content may not contain character references, but script 
data that is the value of an attribute may contain them".

Since the attribute can contain character references, &XXX should be processed 
as a character reference, and so raw ampersands can cause trouble.

(I read the mailing list, please direct responses there and do not CC me, 
thanks).

-- 
David Dorward       <http://blog.dorward.me.uk/>   <http://dorward.me.uk/>
                     Home is where the ~/.bashrc is
Received on Thursday, 18 May 2006 06:39:53 GMT

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