Subject: RE: Netscape7.1 bug or bad code?
From: "Martinez, Brian" <brian.martinez@xxxxxxxxxxx>
Date: Wed, 2 Jul 2003 08:03:05 -0600
|
> From: David Carlisle [mailto:davidc@xxxxxxxxx]
> Sent: Wednesday, July 02, 2003 3:52 AM
> Subject: Re: Netscape7.1 bug or bad code?
>
>
>
> > the JavaScript isn't ignored in Netscape Version 7.02.
>
> I don't know but maybe market forces of keeping users happy
> outweighed the
> logically correct behaviour of treating a comment as a comment...
This is OT, but the original reason for wrapping comment tags around
JavaScript (the code, not the script tags) was so that older browsers that
didn't understand <script/> wouldn't output the code as literal text. Now
that every browser released over the past six or seven years is at least
script-aware, the need for comment tags has been eliminated. Some
old-timers insist on using them, however.
BTW, this will cause problems in output:
<script>
<xsl:comment>
alert("This is a script");
</xsl:comment>
</script>
This will be output as:
<script>
<!--
alert("This is a script");
-->
</script>
which will break most JS interpreters because they will parse the close
comment tag as a decrement operator, then get confused by the right angle
bracket. If you do this in XSLT, you have to add a JS comment delimiter
before closing the comment:
// </xsl:comment>
cheers,
b.
| brian martinez brian.martinez@xxxxxxxxxxx |
| lead gui programmer 303.357.3548 |
| cheap tickets, part of trip network fax 303.357.3380 |
| 6560 greenwood plaza blvd., suite 400 englewood, co 80111 |
| cendant travel distribution services http://www.cheaptickets.com/ |
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|