Re: Bizarre <script> element *solution*

Paul Prescod (papresco@technologist.com)
Mon, 14 Jul 1997 19:15:58 -0400


Message-ID: <33CAB32E.14FA7216@technologist.com>
Date: Mon, 14 Jul 1997 19:15:58 -0400
From: Paul Prescod <papresco@technologist.com>
To: www-html@w3.org
Subject: Re: Bizarre <script> element *solution*

David Perrell wrote:
> The arcane rules of SGML, the sensibility of which is beyond the scope
> of this forum. The pertinent strictures have been incised on the
> standing stones of the ISO, and will remain unchanged til the end of
> time.

That's wrong for two reasons. 

First, SGML has had several fixes, published as "technical corrigenda".
The fixes that are currently on the table are much more radical to its
general structure than any change that has been made to HTML since
forms. 

Second, the construct you are complaining about is likely to be changed
(or deprecated). The primary thing holding it up is the aforementioned
radical changes that have taken priority. Those changes (under
discussion) were requested by the World Wide Web Consortium.

Although this behaviour is annoying, a more major fault lies not with
SGML, but merely with implementations. Most SGML applications avoid
CDATA declared content like the plague. The feature is broken and SGML
provides better features to do the same thing. HTML authors should be
able to use them. In robust SGML applications, escaping is typically
done by the author, in the document:

<SCRIPT type="garbage">
<![CDATA[
   J903284-()*(<>>>><<<<<<<^&^^^^^^&&&&&&&<<<<<>>>>>>><<<<<<
]]>
</SCRIPT>

This feature is also much more generally useful than CDATA declared
content:

<P>Here is an example of a small HTML document:

<PRE>
<![CDATA[
<HTML>
<HEAD>
<TITLE>
This is the title of my example document.
</TITLE>
</HEAD>
<P>This is a paragraph.
<P>This is another paragraph.
</HTML>
]]>
</PRE>

<P>Note the use of the <![CDATA[<TITLE>, </TITLE>, <HEAD> and </HEAD>
tags to create a title in the head.]]>

If you have written about HTML (or SGML) in HTML, then you know how
useful this would be. Technically it is part of the HTML spec (I think)
by virtue of inheriting it from SGMLbut browser vendors do not support
it. This construct is also more consistent than CDATA marked sections. I
think from a user-centric point of view it is less confusing than rules
that change from element to element. It is also very easy to implement.

The solution to the SCRIPT (and STYLE) element (not tag) problem is to
explicitly mention this feature in the HTML specification so that
browser vendors will feel that they cannot implement "HTML 4.0" without
implementing it. I don't think that there is such a mention in the
current spec.

 Paul Prescod