W3C home > Mailing lists > Public > www-validator@w3.org > December 2004

Re: Validator BUG report

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Fri, 31 Dec 2004 13:50:33 +0200 (EET)
To: bbarak@uwo.ca
Cc: www-validator@w3.org
Message-ID: <Pine.GSO.4.58.0412311346090.4884@korppi.cs.tut.fi>

On Wed, 29 Dec 2004 bbarak@uwo.ca wrote:

> However, this occurs in a location.href which occurs in a <script
> type="text/javascript"></script> code region. The validator should NOT be
> looking for &amp; within JavaScript because &amp; is translated into & in HTML,
> not in JavaScript.

No, a validator _must_ process an HTML document according to the formal
rules, and the <script> element _is_ part of the HTML document, and the
mode of processing its content is defined by the document type definition.
You are apparently using XHTML, and in XHTML, the content model for
<script> is #PCDATA, which means that entity references must be
recognized.

The simple solution is to write your JavaScript code into an external file
foo.js and refer to it via
<script type="text/javascript" src="foo.js"></script>

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
Received on Friday, 31 December 2004 11:51:06 GMT

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