W3C home > Mailing lists > Public > www-validator@w3.org > October 2007

Re: Validator failure 20-Oct-2007 : ...is reading javascript strings and checking them

From: Drake Wilson <drake@begriffli.ch>
Date: Sun, 21 Oct 2007 23:27:09 -0500
To: SAMUEL MARCHANT <nicephotog@yahoo.com.au>
Cc: www-validator@w3.org
Message-ID: <20071022042709.GA9977@drache.begriffli.ch>

(Cc'ing the list because you responded to me directly and you didn't
seem to mean that.)

Quoth SAMUEL MARCHANT <nicephotog@yahoo.com.au>, on 2007-10-22 13:44:54 +1000:
> I'm fully aware 
>   <script type="text/javascript">
>   variable_name="string contents cannot be written as proper ordinary html";
> </script> 
>   are HTML tags.
>    
>   The page has always been valid until your recent parser engine/script
>   change.

(I'm not a www-validator developer, just a person on the sidelines.)

It is possible that earlier versions of the validator did not catch
all the errors.

The page is still not valid XHTML 1.0 Transitional, for the reasons
mentioned.  A script tag cannot contain an img tag.  If the script
data is supposed to contain a <, you must escape it with the
appropriate &lt; entity.  (Whether Fred Foobar's Toy Browser 2000
interprets the document that way is a separate issue.)

Did you even look at the page I mentioned, or not?  Here's the address
again, just in case.  Pay attention to when it talks about how script
tags work in XHTML.

  http://www.htmlhelp.com/tools/validator/problems.html#script

It looks like most of your other scripts have XML comments (<!--
... -->) surrounding the text.  This will keep the validator from
complaining about the angled brackets inside them, but that's because
the true XML semantics of those comments mean that there is _no_
script data inside those blocks when the page is actually interpreted
as XML.  That's probably not what you want.  See above referenced
page, again.  Also see the two parts of the XHTML specification linked
from it:

  http://www.w3.org/TR/xhtml1/#h-4.8
  http://www.w3.org/TR/xhtml1/#C_4

The former describes how inline scripts and styles are parsed.  The
latter describes how to be compatible with non-XML user agents when
using them.  In fact, the latter is short enough that I can also
quote it directly here:

| [This appendix is informative.]
|
| C.4. Embedded Style Sheets and Scripts
| 
| Use external style sheets if your style sheet uses < or & or ]]> or
| --. Use external scripts if your script uses < or & or ]]> or
| --. Note that XML parsers are permitted to silently remove the
| contents of comments. Therefore, the historical practice of "hiding"
| scripts and style sheets within "comments" to make the documents
| backward compatible is likely to not work as expected in XML-based
| user agents.
| """

   ---> Drake Wilson
Received on Monday, 22 October 2007 04:27:36 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:26 GMT