HTML comments within JavaScript - Netscape documentation ??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Griff

    HTML comments within JavaScript - Netscape documentation ??

    Hi there

    About this business of embedding HTML comments in Javascript.

    Everyone tells me that JavaScript parsing ignores any line starting
    with <!--
    but that I need to protect any occurrence of --> with a Javascript
    comment //.

    My browser (IE 6) seems to handle <!-- as described, but also seems
    to ignore occurrences of -->, with or without a leading //.

    I was trying to look up the official ruling on this in the
    JavaScript 1.5 Guide and Reference on Netscape, but I can't seem to
    find any mention of it in the various Netscape documents. So is this
    an undocumented convention which JavaScript compliant browsers can
    choose to handle just as they like ?

    thanks

    - griff
  • Lasse Reichstein Nielsen

    #2
    Re: HTML comments within JavaScript - Netscape documentation ??

    "Richard Cornford" <richard@litote s.demon.co.uk> writes:
    [color=blue]
    > The browsers that were new when it was introduced are now the oldest
    > still in use.[/color]

    They are not even close to being in use. The script tag, and the HTML
    comment convetion, was introduced with the transition from Netscape 1
    to Netscape 2. The release of Netscape 2.0 was March 1996. Netscape 2
    works fine without the HTML comments.

    IE supported scripts from v3.0(beta1) in May 1996.

    The script tag was then introduced into HTML 3.2, which was made a
    recommendation in 1997.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Richard Cornford

      #3
      Re: HTML comments within JavaScript - Netscape documentation ??

      "Lasse Reichstein Nielsen" <lrn@hotpop.com > wrote in message
      news:vftla2y5.f sf@hotpop.com.. .[color=blue][color=green]
      >>The browsers that were new when it was introduced are now
      >>the oldest still in use.[/color]
      >
      >They are not even close to being in use. ...[/color]
      <snip>[color=blue]
      > ... . The release of Netscape 2.0 was March 1996. ...[/color]
      <snip>

      Yep you are right. I will have to switch to saying "The browsers that
      were new when it was introduced are not even still in use.".

      (Though I did recently discover that Sheffield university is still
      running some machines with Window 3.1 installed, but I doubt that anyone
      does much web browsing from them.)

      Richard.


      Comment

      • Jim Ley

        #4
        Re: HTML comments within JavaScript - Netscape documentation ??

        On Tue, 29 Jul 2003 12:30:28 +0000 (UTC), "Richard Cornford"
        <richard@litote s.demon.co.uk> wrote:
        [color=blue]
        > But
        >there is no evidence that any of the browsers that are currently in use
        >do not know how to handle SCRIPT tags properly, so there is no reason
        >for using this "hide from older browsers" stuff at all. The browsers
        >that were new when it was introduced are now the oldest still in use.[/color]

        Also if you're the sort of person who follows such cargo-cults, you
        may be the sort of person to jump on the XHTML bandwagon, and for
        XHTML the browser is free to chuck away everything inside a comment,
        so your script could simply disappear.

        Jim.
        --
        comp.lang.javas cript FAQ - http://jibbering.com/faq/

        Comment

        Working...