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

Received on Saturday, 27 July 1996 04:50:18 UTC