Re: XHTML (was Re: Wrapping paragraph text around blocks)

On Fri, 25 Mar 2005 09:41:58 -0500, Edward Lass <elass@goer.state.ny.us>
wrote:

> Regarding the p element, IE's tag soup parser has no problem ignoring
> the XML trailing slashes, which it doesn't regard as any sort of valid
> construct. The same would happen in this situation. The major browser
> will get the semantics wrong, but the content will still come across. I
> don't think the sky would fall.

I think you midunderstand.  Browsers use HTML parsers for the content type
text/html (and IE doesn't doesn't have any other viable option when it
comes to XHTML).  HTML 4.01 allows the implied closure of the <p> element
when it's followed by a block-level element because its content model is
strictly inline.  Hence, to current HTML browsers, this:

<p>This is a paragraph
   <ul><li>which contains a list</li></ul>
</p>

would in practice be parsed as this:

<p>This is a paragraph</p>
<ul><li>which is followed by a list</li></ul>

This would cause problems for both document-manipulating scripts and CSS,
since the selectors 'p ul' or 'p>ul' would never work and
p.getElementsByTagName('ul') wouldn't return any elements.

-- 
J. King
http://jking.dark-phantasy.com/

Received on Friday, 25 March 2005 15:25:32 UTC