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

Re: Error Message Feedback

From: David Dorward <david@dorward.me.uk>
Date: Tue, 8 Aug 2006 10:08:07 +0100
To: www-validator@w3.org
Message-ID: <20060808090807.GA29017@us-lot.org>

On Tue, Aug 08, 2006 at 09:47:02AM +0100, Neil Smith wrote:
> This was discussed last week - technically it's incorrect to have the
> closing angle bracket inside your javascript string.

No, closing angle brackets are fine. Opening angle brackets cause
problems, as do ampersands.

> You could reasonably use the decimal character entity &#60;
> instead. 

That is an opening angle bracket, but it will cause problems for XHTML
served as HTML (since <script> elements implicitly contain CDATA in
HTML documents).

> Many people now enclose script blocks in CDATA sections,
> i.e.  http://www.w3schools.com/xml/xml_cdata.asp
> <![CDATA[
> <script language="javascript" type="text/javascript">

The script element should contain CDATA, it shouldn't me marked as
CDATA itself - otherwise browsers (treating the XHTML as XHTML rather
than broken HTML) will render the entire script element as text!

You also need to take steps so that the CDATA isn't treated as
JavaScript if the document is served as HTML.

The XHTML spec has suggestions on dealing with this. I just avoid
XHTML on the client side except in situations where it provides a real
benefit (which, so far, with the content I write, has been never).

> A better solution is to tell PHP to use XHTML compatible argmuent
> separators 

The requirement is not restricted to XHTML, it applies to HTML too.

> (it's actually a bug in PHP's default setting on some versions).

On some versions? When did they fix it? Last time I looked at the bug
I got the impression that the developers were convinced that
generating correct HTML by default would break people's scripts.

> You're not sending it what "normal" user agents would see

Rejecting cookies isn't /that/ unusual.

David Dorward                                      http://dorward.me.uk
Received on Tuesday, 8 August 2006 09:08:28 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:17:49 UTC