Re: javascript validation problems

On Tue, Jan 16, 2007 at 04:04:03PM -0000, Jason Millward wrote:
>    Below is a list of the warning message(s) produced when validating
>    your document.
>     1. Warning Line 15 column 18: character "&" is the first character of
>        a delimiter but occurred as data.

IIRC correctly this should be an error, not a warning, and clients are
supposed to fall over on it.
 
>           + You used an unescaped ampersand "&": this may be valid in
>             some contexts, but it is recommended to use "&", which is
>             always safe.

Those contexts are specific to HTML and don't apply in XHTML.

>    but when I used the css validator I get the following error:
>    Please, validate your XML document first!
>    The entity name must immediately follow the '&' in the entity
>    reference.

Yes, it is an error, not a warning. The CSS validator couldn't parse
the XML because it had such an error in it.
 
>    Is there anything I can do to bypass this or is it possible to change
>    the javascript so it is valid?

As it said - 'it is recommended to use "&"'

... except you are serving XHTML as text/html and have to contend with
the joys of having to make the XHTML as much like HTML as possible.

Since text/html XHTML can't gain any of the client side benefits of
XHTML I suggest you switch to HTML 4.01 (either in your source
document, or in a transformation during the publishing or serving
phase).

If you want to stick with XHTML, then I suggest you reread the
sections on script and style elements in the spec (in the changes from
HTML 4.01 section and in Appendix C).

(on the subject of Appendix C, you should also check out C2 as you are
missing some trailing spaces)

http://www.w3.org/TR/xhtml1/

-- 
David Dorward                                      http://dorward.me.uk

Received on Tuesday, 16 January 2007 18:42:52 UTC