0

Is there any way to escape the angle brackets (or even the entire script tags) inside this html comment block?

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"/>

<script type="text/javascript" src="20140330_v100.js"/> 

<!-- 
    The above can also be written with a closing script tag as:

        <script type="text/javascript" src="20140330_v100.js" ></script>

        <link rel="stylesheet" type="text/css" href="20140330_v100.css" ></script>

    but I think the earlier form is the better one for XHTML
-->
thanks_in_advance
  • 2,603
  • 6
  • 28
  • 44

1 Answers1

2

What you have here should be fine without any further escaping. The only thing you need to escape inside of an HTML comment is an end-comment sequence, --. If the block you're commenting out already contains comments, you need to go in and remove or modify all the existing double-dash sequences.

Roger Powell
  • 245
  • 1
  • 3
  • Interesting. But unfortunately, the browser (Chrome) is reading it as a comment only up to the end of the second tag. – thanks_in_advance Apr 16 '14 at 21:18
  • @user1883050, what version of Chrome might that be? And please show a complete document where such a problem appears, and specify how you inferred what Chrome does. – Jukka K. Korpela Apr 16 '14 at 21:47
  • @JukkaK.Korpela I've updated the post to add 2 lines of offending code before the comment block. These 2 didn't have regular closing script tags, and I think that was causing the problem. I thought the "/>" would have obviated the need for the regular closing script tag... apparently I was wrong. – thanks_in_advance Apr 17 '14 at 21:53
  • So this is about a “self-closing” `script` element, not about `<` and `>` in comment content. – Jukka K. Korpela Apr 18 '14 at 05:52
  • @JukkaK.Korpela Possibly so, I'm not really sure though! – thanks_in_advance Apr 18 '14 at 08:27