- From: Tim Bagot <tsb-w3-validator-0007@earth.li>
- Date: Wed, 29 Jan 2003 18:46:08 +0000 (UTC)
- To: <www-validator@w3.org>
- Cc: "Brinkman, Dave" <Dave.Brinkman@stockport.ac.uk>
At 2003-01-29T16:34-0000, Brinkman, Dave wrote:-
> Problem 2
>
> This validator is throwing out as invalid any JavaScript comparisons
> with < as if it needed < which incorrect since the validator should
> not force the use of html comments or xml CDATA within JavaScript.
In HTML: "Comments" are just a hack to stop old, script-unaware browsers
displaying the content, and in theory get passed to the scripting engine
as-is; technically, they are not required. "<" in script content is fine.
"<" won't work, because "&" has no special meaning in CDATA content.
What you must avoid is any occurrence of "</", because that will terminate
the CDATA content. In (Java|ECMA)Script, for example, you can escape the
"/" ("<\/") or use string concatenation.
In XHTML: The CDATA content model does not exist in XML; script content is
now PCDATA. Therefore comments really are comments and "<" in the script
must be escaped. You can use < (or < etc.), or put all or part of
the script in a CDATA section. The compatibility guidelines recommend
using an external script instead.
> Problem 3
>
> This validator is throwing out as invalid any 'get' data within an
> href="url?... " that has an ampersand in. Yes I know & works but
> it is already within quotes and should be ignored as CDATA.
Unfortunately and inexplicably, CDATA for attribute values is not the same
as CDATA for element content. You must use & (or equivalent). (Or, if
the application on the server supports it, use ";" instead of "&".)
Tim Bagot
Received on Wednesday, 29 January 2003 13:46:13 UTC