[CSS21] WD 9.2.2.1: collapsible whitespace, elements & boxes

  # Any text that is directly contained inside a block container element
  # (not inside an inline element) must be treated as an anonymous inline
  # element.

  ...

  # White space content that would subsequently be collapsed away
  # according to the 'white-space' property does not generate any
  # anonymous inline boxes.

Note that in the above wording, such white space still results in an
anonymous inline element, it's just that this content mustn't generate
any anonymous inline boxes.

One problem is that this seems to conflict with other parts of the spec
which I understand to say that inline elements do generate inline boxes.

(Yes, that still leaves the possibility of generating a non-anonymous
inline box, but obviously that would be contrary to the intent of that
second paragraph.  Similarly, the interpretation "the content doesn't
generate any boxes, but the anonymous inline element does" clearly
wouldn't have the intended effect.)

Another problem is that the existing text means that

   <h3>Run-in</h3>
   <p>To this?</p>

doesn't run-in, because the whitespace between the h3 and the p "must be
treated as an ... inline element" according to the first paragraph, and
thus is "the first of [the h3]'s following siblings that is neither
floating nor absolutely positioned nor has 'display: none'", and does not
"[have] a specified value for 'display' of 'block' or 'list-item'", so
the h3 "is rendered as if it had 'display: block'".  (The fact that this
element doesn't go on to result in a box is irrelevant to the current
§9.2.3 text.)


So it looks as if what we actually want is for collapsible whitespace not
to be treated as an inline element at all.  This can be accomplished by
changing the first paragraph to add a qualification to exclude the case
of text that is white space that would subsequently be collapsed away
according to the 'white-space' property.  (The second of the quoted
paragraphs could then be removed.)

(Having element creation rather than just box creation depend on whether
the content is collapsible does create some concern as to whether it
affects anything else, but I can't think of anything it would affect.)

pjrm.

Received on Sunday, 9 January 2011 20:28:27 UTC