Re: Cougar DTD: Do not use CDATA declared content for SCRIPT

Ka-Ping Yee (kpyee@aw.sgi.com)
Sat, 27 Jul 1996 17:32:01 +0900


Message-Id: <31F9D401.167E@aw.sgi.com>
Date: Sat, 27 Jul 1996 17:32:01 +0900
From: Ka-Ping Yee <kpyee@aw.sgi.com>
To: David Perrell <davidp@earthlink.net>
Cc: Ka-Ping Yee <kpyee@aw.sgi.com>, www-html@w3.org
Subject: Re: Cougar DTD: Do not use CDATA declared content for SCRIPT

David Perrell wrote:
> 
> What is a "marked section?" Don't opening and closing tags mark a
> section?

Not the same thing -- opening and closing tags mark an HTML element.
Within that HTML element, <, >, </, etc. mean something to the parser
and could have disastrous effects.

An SGML marked section declaring the inside as CDATA specifially
tells the parser to leave the script alone.  All explained by Arne
Knudson in another post.

> But I still don't see the nightmare.

I can't say it loud enough: MIXING LANGUAGES IS BAD.

If asked for a single, final word, i would without hesitation say
"EXTERNAL FILES" and be done with it.  What about when streamlined
JavaScript or CSS editors for authors arrive, huh?

------------------------------------------------------------------------

The only reason i continue to discuss this is that i know many people
will still want to inline their scripts.  So suppose we consider the
options from a purely practical point of view:

How likely will you find HTML tags in a script?
    Very common.  In JavaScript that generates HTML, all over the place.

How likely will you find "</" in a script?
    Still very common.  So making <SCRIPT> a CDATA element isn't enough.

How likely will you find "--" in a script?
    Lots of times.  So putting your scripts in comments is bad.

How likely will you find "]]>" in a script?
    MUCH less likely.

The answer should be clear.

Moreover, looking for the end of a marked section is EASY: just scan
for "]]>", cut out the script and continue.  Much easier than trying
to guess whether you're inside a JavaScript string or not.

It's less work for everybody.  The solution is so obvious.


Ping