Re: Suggestion: Scripts should not be checked as HTML

[Quoted paragraphs reformatted.]
Quoth IceMetalPunk <IceMetalPunk@comcast.net>, on 2007-03-31 23:50:08 -0400:
> I was checking this URL: http://icemetalpunk.dajoob.com/Sweet_Beans/contact.html
> 
> As you can see, especially if you check it with the source shown,
> all the errors come from within JavaScript and are untrue once the
> script is finished executing. I don't think the (X)HTML validator
> should check within scripts, as they aren't (X)HTML. Just a
> suggestion.

Well, in XHTML, at least, you cannot put raw < > & characters and the
like inside script tags and expect them to not be interpreted as tags,
because that violates the rules of XML.  You have to escape them using
a CDATA section or using appropriate entities.

In HTML 4.01, it's somewhat different, since it's SGML, not XML;
however, you still can't use any "</" sequences inside script data.
The HTML 4.01 spec, section B.3.2,
http://www.w3.org/TR/html4/appendix/notes.html#h-B.3.2 ("Specifying
non-HTML data") tells you how to deal with this.  I interpret your
problem to be exactly the one in that section.

BTW, somewhat off-topic, but your email address sanity checking
regular expression is broken.  ccTLDs have fewer than three
characters, and local-parts and other domain-part fragments can
certainly be fewer than three characters.  My email address, for
instance, is not accepted because it ends in .ch.  And you're not
anchoring the match to start or end of string, AFAICT, so you're just
matching any substring...

> -IMP ;) :) 

   ---> Drake Wilson

Received on Sunday, 1 April 2007 17:07:48 UTC