[whatwg] Comment Syntax and Parsing

Ian Hickson ian at hixie.ch
Tue Jan 24 15:13:37 PST 2006


On Wed, 25 Jan 2006, Lachlan Hunt wrote:
>
> Ian Hickson wrote:
> > On Tue, 24 Jan 2006, Lachlan Hunt wrote:
> > > PA<!- <!-->SS -->                  | "- <!"                   | PASS -->
> > 
> > Comment should be "- <!--" IMHO. It's still a bogus comment (in HTML5
> > nomenclature), the "--" part is irrelevant.
> 
> Ok, so if a comment only starts with '<!' then it ends at the first '>' only
> (ignoring any '--'), but if a comment starts with '<!--' then it must end with
> '-->'.

Right. They end up in different parse states ("bogus comment" or "bogus 
tag" or something, vs "comment" or something). This is for compatibility 
with existing UAs -- basically it's not a comment really, just a malformed 
tag that happens to be turned into a Comment node in the DOM.


> > > PA<!-- > FAIL -- >SS               | " > FAIL "               | PASS
> > 
> > Disagree. The terminator should be "-->", not "-- S* >". I don't see any
> > good reason to have "-- S* >".
> 
> I was working on the assumption that the comment would end at the first 
> occurance of '>' while in the comment end state, but that whitespace 
> would be ignored while searching for it.  Several browsers already 
> handle it like that including Mozilla, Opera and Safari (except in 
> Opera, the comment contained " > FAIL -").  Although IE, OmniWeb and 
> iCab failed.

Really? In my testing, browsers didn't reliably do this. Were you testing 
standards mode or quirks mode? Did you have the potential to be hitting 
unexpected-EOF-reparse behaviour, or was it definitely the first-parse 
behaviour?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list