[whatwg] Ending comments with --!>

Adam Barth whatwg at adambarth.com
Fri Jun 27 00:13:58 PDT 2008


Ian explained to me on IRC that IE and Opera are consuming the entire
document as a comment and reparsing for > (i.e., --!> is not treated
specially).  That is supported by the following test case:

http://crypto.stanford.edu/~abarth/research/html5/comments/bang-gt.html

Safari and Firefox contain explicit code for detecting --!> (as
demonstrated by the above test case).  In Safari, the code was
introduced in

http://trac.webkit.org/changeset/4103

In Firefox, the code was introduced in

https://bugzilla.mozilla.org/show_bug.cgi?id=110544

As far as I can tell, neither checkin explains why this behavior was added.

Adam


On Thu, Jun 26, 2008 at 10:30 PM, Adam Barth <whatwg at adambarth.com> wrote:
> Internet Explorer 7, Firefox 3, Safari 3.1, and Opera 9.5 accept --!>
> as an alternate comment terminator to the usual -->
>
> http://crypto.stanford.edu/~abarth/research/html5/comments/strange-ending.html
>
> In Internet Explorer 7 and Opera 9.5, if the document later contains
> the usual comment terminator, then that character sequence terminates
> the comment instead:
>
> http://crypto.stanford.edu/~abarth/research/html5/comments/strange-ending-with-real-ending.html
> http://crypto.stanford.edu/~abarth/research/html5/comments/strange-ending-with-later-comment.html
>
> Firefox 3 and Safari 3.1 do not appear to exhibit this behavior.
>
> (Interestingly, the syntax highlighter in vim suggests the document
> will be parsed as in Firefox and Safari, no doubt contributing to
> author confusion.)
>
> Adam
>



More information about the whatwg mailing list