Re: Scripts as Comments [Was: Comments in markup?]

Abigail (
Tue, 30 Jul 1996 17:30:51 +0100

Message-ID: <>
Date: Tue, 30 Jul 1996 17:30:51 +0100
From: Abigail <>
Subject: Re: Scripts as Comments [Was: Comments in markup?]

Murray Altheim wrote:
> I'll again point to my documentation on HTML comments to clarify the
> correct structure of a comment declaration, as your language is somewhat
> misleading but on the whole true. Regarding the actual issue here (using
> comment declarations to hide scripts) yes, you're correct. I think it
> unwise to build a structure that requires authors to regard the structure
> of one language (SGML/HTML) while writing a script in another, unrelated
> language (Javascript, perl, etc.), ie., the occurrence of double hyphens in
> HTML is not something one should be thinking about when writing in
> Javascript. Not very elegant and seems quite a hack.

I would even say it stronger. Whenever I write a comment, I expect it
to be treated as a comment, and hence to be left alone by all browsers.
I should _never_ have to worry if the content gets parsed by a browser
I don't know, or which hasn't been coded yet.
Netscape's hack to check the content of comments for Java, JavaScript
or billing orders has started a very bad practise.

I may now want (for whatever reason) to put some Perl code inside comments.
Should I refrain from doing so, just because some browser at some point
in time might decide to check comments for Perl code, and execute it in
stead of ignoring it? What's next? Checking for plain text and showing that?

> >        <SCRIPT ...>...</SCRIPT> is almost OK with "add hoc" parsers
> >that just look for the end tag, but those still could get tripped
> >up if </SCRIPT> were in a script statement and not really the end
> >tag, and it seems basically to have the same problem for real SMGL
> >parses as do PLAINTEXT and XMP.
> >
> >        <![[ also has the problem that a script statement might include
> >what looks like it's terminator.
> You'll always be dealing with backward-compatibility. This should properly
> be handled by server-side content negotiation.
> I think it's simply a matter here of requiring script-capable browsers to
> understand SGML marked section syntax. Vendors are busy modifying browsers
> to handle Javascript; it's simply part of that solution. Marked sections
> are not a difficult parse, and would enable its use for other legitimate
> SGML structures as well. And it is at least in theory something HTML should
> allow if it truly calls itself 8879-compliant. I think the incidence of
> "]]>" occurring in Javascript or perl sufficiently rare enought to not be
> that much of a problem. Has ANYBODY ran across a real-world need to ever
> use those three characters in a script?

Well, it will happen if you use the value of one array to index another.
And in my experience that happens more likely when using hashes or
associative arrays. Perl uses {} to index hashes, but I frequently use
a language which uses [] to index both arrays and hashes (or mappings
as they are called there). The use of ]]> isn't foreign to me. (Though
personally, I always surround binary infix operators with white space).