SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict piku's Avatar
    Join Date
    Oct 2003
    Location
    Alameda, CA
    Posts
    239
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Comment tags (hide-script) still necessary?

    Hey gang,

    Trying to find facts that support the reasoning of not putting comment tags in JS blocks are okay if support for very, very old browsers is not a concern. The list of the browsers supported are as follows: IE6+/PC, Safari (up-to-date), and FF. I found the following article while searching:

    http://www.netmechanic.com/news/vol6...cript_no12.htm

    Which cites http://www.w3.org/TR/xhtml1/#C_4

    C.4. Embedded Style Sheets and Scripts

    Use external style sheets if your style sheet uses < or & or ]]> or --. Use external scripts if your script uses < or & or ]]> or --. Note that XML parsers are permitted to silently remove the contents of comments. Therefore, the historical practice of "hiding" scripts and style sheets within "comments" to make the documents backward compatible is likely to not work as expected in XML-based user agents.
    It seems that both articles haven't been updated lately, so I am just trying to find the current consensus regarding the matter. Pointers, URLs, etc. greatly appreciated.

    TIA
    Sherwin

  2. #2
    SitePoint Addict Mirek Komárek's Avatar
    Join Date
    Dec 2006
    Location
    Prague
    Posts
    210
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This works, even if you use suffix .xhtml
    Code:
    <script type="text/javascript">
    <!--//--><![CDATA[//><!--
    
    //--><!]]>
    </script>
    Read this: http://www.hixie.ch/advocacy/xhtml

  3. #3
    SitePoint Guru
    Join Date
    Apr 2006
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use external scripts.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •