Re: Ignoring empty paragraphs

Daniel Glazman wrote:
> Dan Connolly a écrit :
> >         The P element represents a paragraph [cite strunk & white or
> >         some such as an informative reference regarding the meaning
> >         of the term 'paragraph']. As paragraphs in
> >         conventional usage are not empty, this specification assigns
> >         no meaning to an empty paragraph. Authors should include
> >         at least one character, word, image, or form control
> >         in each paragraph.
> Hmm... What about the following fragment :
>   <P><SPAN STYLE="display:none">foo</SPAN></P>
> >From a rendering engine point of view, it is almost an empty
> paragraph, isn't it ?

First of all, note that the stuff about "at least one ... word ..."
was a 'should', not a 'must', so the formalities aren't critical.

But examining the formalities... that is a paragraph with exactly
one word in it. The HTML definition of a word is not impacted
by stylesheets:

	"For all HTML elements except PRE, sequences of white space separate
	"words" (we use  the term "word" here to mean "sequences of non-white
	space characters"). When formatting text, user agents should identify
	these words and lay them out according to the
        conventions of the particular written language (script) and
target medium."

HTML 2.0 was slightly more explicit:

	"each block structuring element is regarded as
	a paragraph by taking the data characters in its content and the
	content of its descendant elements, concatenating them, and splitting
	the result into words, separated by space, tab, or record end
	(and perhaps hyphen characters). "

> And what about a P containing a HIDDEN form control ?

What about it?

We could word-smith my text to be more
explicit: "... non-hidden form control"
or less explicit: "... character, word, image, or other item"

but since it's not actually going in the spec, I don't see why bother.

The bottom line is: I agree that P elements should be visible in
the DOM regardless of whether there's anything inside them,
and that while css-based layout engines should default to no
vertical whitespace for an empty P, it should follow
instructions in other stylesheets that say that an empty P
should take up some space.

I don't want folks to read
the HTML spec as saying "no empty P shall occupy vertical
whitespace under any circumstances, and no script shall
be able to manipulate the attributes, content, nor properties
of an empty P element."

Bit I'd like to discourage authors from relying on <p><p><p>
to skootch their text down a little bit.

Dan Connolly, W3C
pager (put return tel# in From or Subject field)

Received on Thursday, 13 April 2000 16:57:01 UTC