[whatwg] Ending comments with --!>

Adam Barth whatwg at adambarth.com
Fri Jun 27 13:57:59 PDT 2008


It looks like Mozilla is planning to change their behavior to match
the HTML5 spec in this regard.  See the patch in
<https://bugzilla.mozilla.org/show_bug.cgi?id=214476>.

Adam


On Fri, Jun 27, 2008 at 1:52 PM, Maciej Stachowiak <mjs at apple.com> wrote:
>
> On Jun 27, 2008, at 12:13 AM, Adam Barth wrote:
>
>> 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.
>
> Hyatt's comment on the WebKit checkin says it was to match other browsers
> (presumably Mozilla).
>
> Regards,
> Maciej
>
>>
>>
>> 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