Re: validator bug?

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 UTC