- From: Greg Faron <gfaron@integretechpub.com>
- Date: Tue, 23 Apr 2002 14:46:54 -0600
- To: www-html@w3.org
Hello, I've been directed to the XML spec in which it states that "for compatibility, the string '--' (double-hyphen) must not occur within comments." I assume it refers to the compatibility with SGML (of which I know very little). I find this to be a great hindrance when creating valid XHTML (Transitional) pages that use JavaScript. Consider the commonly used unary decrement operator. The script below (admittedly contrived) is invalid because of this seemingly arbitrary compliance. <script type="text/javascript"> <!-- for (var i = 100; i > 0; i --) // FAILURE! { if (!(someField[i].checked)) document.write('Question ' + i + ' has not been answered\n'); } // ends for --> </script> What is the commonly accepted workaround for this? Should I not use <!-- ... --> to envelop my script? Am I suppose to reverse my logic in the case above, and use "i = i - 1" or "i -= 1" as necessary elsewhere? I don't believe I'm allowed to use <![CDATA[ ... ]]> outside of XSLT transformations (but I may be wrong here). Please advise... Greg Faron Integre Technical Publishing Co.
Received on Tuesday, 23 April 2002 16:47:47 UTC