Re: Validator BUG report

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 UTC