Re: Ignoring empty paragraphs

On Sun, 9 Apr 2000, Jan Roland Eriksson wrote:

> On Tue, 4 Apr 2000 03:09:26 -0400 (EDT), "Braden N. McDaniel"
> <braden@endoframe.com> wrote:
> 
> >On Tue, 4 Apr 2000, Jan Roland Eriksson wrote:
> >> On Mon, 3 Apr 2000 19:53:18 -0400 (EDT), "L. David Baron"
> >> <dbaron@fas.harvard.edu> wrote:
> >> > 1) An empty P element should be ignored at the parsing stage, and
> >> >    therefore should not appear in the DOM and should not be affected
> >> >    by style sheets.
> >> 
> >> This is the correct interpretation.
> 
> [...]
> 
> >> If there's nothing to mark-up, there's no motivation for markup either.
> 
> >Indeed, but it is *not* the parser's job to fix errant document structure! 
> >It is the parser's job to read the markup that's there. And as long as
> >it's valid, the DOM tree should have a direct correspondence to the
> >plaintext representation.
> 
> Fair enough. But...
> 
> What about "styling" of non existing content?
> Leave that no-content element dangling in the DOM tree and we need to
> move the decision not to style it to the CSS renderer instead.
> 
> If not, we will not have a way to discourage the use of successive P's
> for vertical spacing, and that is what I think David's question was all
> about.
> 

If that is the question (it seems a good one), then the problem would
appear to be much harder, since what you really want is conditional
formatting properties depending on whether 'some' elements contain
only ignorable white space (in the XML sense). But HTML is not XML, and I
don't think HTML parsers can flag this difference. With XML. I suppose
that the formatting software could take each element, do a test on child
nodes, test on the text content (if the element only contains text), and
then set display:none for 'appropriate' elements, but that seems so venal
that I can't imagine it become a recommended practice...  If that proved
to be the only way to do this,  I'd rather live with empty <p>'s
that produce spaces :(


Ian

Received on Sunday, 9 April 2000 15:31:30 UTC