Re: [www-validator] <none>

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 &lt; 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.
"&lt;" 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 &lt; (or &#60; 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 &amp; 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 &amp; (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