HTML comments in JS

James Graham jgraham at
Fri Jul 23 13:28:53 PDT 2010

On Fri, 23 Jul 2010, Brendan Eich wrote:

> On Jul 23, 2010, at 12:26 PM, Oliver Hunt wrote:
>> So I was just looking at a site bug in WebKit and found that the reason 
>> for the bug was JSC failing to treat --> as a comment.
> Originally, I avoided adding two new comment-to-end-of-line special 
> cases for nesting JS inside the script tag's CDATA unmarked-section 
> content model, by making only <!-- start a comment to end of line. In 
> Netscape 2 and for years after, even in Mozilla, you had to use a JS 
> comment to hide the --> from the JS parser, letting the HTML parser see 
> it still:
>> Could someone investigate IE behaviour (i assume it matches the 
>> firefox, etc behaviour but more facts === better)?

You might also be interested in [1]


More information about the es5-discuss mailing list