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

Re: elements other than HTML on web pages

From: Terje Bless <link@tss.no>
Date: Wed, 04 Oct 2000 02:06:39 +0200
Message-ID: <39DA748F.3B37E71F@tss.no>
To: John Sankey <bf250@freenet.carleton.ca>
CC: www-validator@w3.org
John Sankey wrote:

> I'd like to suggest that an HTML parser such as you provide should only look
> at what is between the <html> and </html> tags. HTML should not be
> considered invalid if it is followed by a <script>...</script> - that should
> be left for a script parser e.g. Javascript. More and more sites are tacking
> on a segment of Javascript for various reasons (e.g. Geocities) - surely a
> page with 100% valid HTML between the <html> and  </html> tags should pass.

Nope. SCRIPT, indeed most elements, are invalid outside HTML. If your
provider modifies your HTML you should consider switching providers IMO.

A workaround for the specific example you provided is to leave off the
closing tag for HTML. That way the SCRIPT element will be interpreted as
being inside the HTML element and it will be implicitly closed at the
end of the document. Always provided, of course, that you are using a
document type that allows implicitly closed elements.

<!-- The end of your code -->
<!-- GeoCities tacks on the following -->
<SCRIPT><!-- some JavaScript --></SCRIPT>
<!-- The HTML element is implicitly closed here -->
Received on Tuesday, 3 October 2000 20:12:27 UTC

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