Re: CSS on invalid HTML

Jukka K. Korpela wrote:
>> That would mean that no requirements are imposed, since HTML
>> specifications do not set any requirements on error processing, or on the
>> generation of a DOM (even for valid documents).

Boris Zbarsky wrote:
> That's true.  And an HTML processor that deals with HTML without 
> building a document tree (eg NS4) would probably have a hard time 
> implementing CSS in any sort of reasonable way.....  The behavior of CSS 
> would have to be as if a document tree had in fact been built.

Just as an interesting sidenote: I've noticed that Opera (at least 
version 7.5) seems to use a rather fragile parsing engine, as this 
(valid) XHTML tag will cause Opera to mess up it's styling:

<span />

Everything before the tag will be styled correctly, but anything after 
the tag will not be styled.

The interesting thing is that Opera seems to employ a state machine 
instead of an XML parser to parse XHTML documents. I guess they never 
anticipated that an empty SPAN could be useful for anything. In my case 
I used it to circumvent an Internet Explorer rendering bug.

After replacing <span /> with <span></span> things worked fine.


PS. I realize this is not completely on topic for this list, but I 
suspect many subscribers can find this information useful when authoring 
documents. My appologies to those who disagree.

Max Romantschuk

Received on Friday, 4 June 2004 03:10:02 UTC