[whatwg] About adopting quirks mode parsing

Ian Hickson ian at hixie.ch
Sun Jun 18 23:15:01 PDT 2006


On Sun, 18 Jun 2006, Simon Pieters wrote:
> 
> The spec asks whether quirks mode parsing should be adopted[1]. I think 
> it would be good if parsing worked more or less the same in quirks and 
> standards mode. If we want to adopt quirks mode parsing, then here are 
> some remarks:
> 
> > Comment parsing is different.
> 
> I think the current parsing algorithm for comments should remain. I 
> don't think we should adopt IE's "overlapping" comments (<!--> being one 
> comment), because that isn't logical and isn't how they work in XML and 
> comments in other languages (such as /*/ in CSS isn't one comment).

I agree. However, in quirks mode this is a requirement. So if we make the 
parsing quirks-compatible (as in, if we remove DOCTYPE-switching for 
parsing), we have no choice.


> > The following is considered one script block (!):
> > 
> >      <script><!-- document.write('</script>'); --></script>
> 
> This one is common, I think, and applies to IE6, Safari and Opera even 
> in Standards Mode. Script parsing seems to work like this in Mozilla in 
> Quirks Mode:
>
> 1. If the parser hits the string "<!--" then set a flag to ignore </script>
> tags.
> 2. If the parser then hits the string "-->" then reset the flag.
> 3. The flag can only be set once.
> 4. If the parser hits EOF, then reset the flag (if it is set) and reparse the
> script.
> 
> Opera seems to do the same as Mozilla.

Anything that depends on EOF is a bad idea for security reasons, so I 
would be reluctant to do that...

> We would have to drop reparsing though.

...which you seem to agree with. :-)


> I've tried to figure out exactly what IE does, but I have failed. It 
> seems to do reparsing sometimes, and others not, and --> after the 
> </script> tag makes a difference, and also whether there are characters 
> after the --> (before EOF). The flag can also be set more than once.
> 
> Safari seems to do pretty much what IE does.

Can't spec what I can't describe! :-)


> > </br> and </p> do magical things.
> 
> I guess those magical things are that </br> is treated as <br>, and that </p>
> is treated as <p></p>? If so, then that seems more or less harmless.

Yeah.


> > p can contain table
> 
> I think this might be a good thing. I would also like p to be able to contain
> other struct-inline elements, but perhaps that isn't really possible.

Indeed.


> > Safari and IE have special parsing rules for <% ... %> (even in 
> > standards mode, though clearly this should be quirks-only).
> 
> This wouldn't be a bogus comment, as bogus comments end with > (while 
> these end with %>), but I think it would be possible to add this if we 
> want to be more compatible with IE.

Oh we could add anything to be compatible with IE... the questions are do 
we want to be, and do we need to be.

Like you, I don't know. :-) I want to do some research on this in due 
course, but I haven't been able to do it yet.

-- 
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