W3C home > Mailing lists > Public > www-style@w3.org > September 2003

Re: CSS3 Genrated content, comments/questions

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Tue, 16 Sep 2003 10:37:09 -0400
Message-Id: <200309161437.h8GEb98L009510@all-night-tool.mit.edu>
To: staffan.mahlen@comhem.se
Cc: Ian Hickson <ian@hixie.ch>, "www-style@w3.org" <www-style@w3.org>

>     <table>
>       <tr><td>First</td><td>Second</td></tr>
>       Third
>       <tr><td>Fourth</td></tr>
>     </table>

Given this HTML, a typical HTML parser will do some error-recovery because a
text node is not allowed as a child of the table node in HTML.  Typically, the
parser will create the following DOM tree:

HTML
 \_BODY
    |\_#text ("Third")
    |
    \__TABLE
       \_.....

That is, by the time CSS sees the DOM tree, the text is NOT a child of that
table.  The case Ian is talking about is when there is a text node in the DOM
and its parent has display:table.  To see how current browsers handle this
case, you need to put it there via DOM manipulation, typically.

Alternately, you can do something like:

<div style="display: table">
  <div style="display: table-row">
    <div style="display: table-cell">First</div>
    <div style="display: table-cell">Second</div>
  </div>
  Third
  <div style="display: table-row">
    <div style="display: table-cell">Fourth</div>
  </div>
</div>

which will create the right CSS box model for testing this, assuming the
browser supports those display values, of course.

Boris
-- 
Washington [D.C.] is a city of Southern efficiency and
Northern charm.
                       -- John F. Kennedy
Received on Tuesday, 16 September 2003 10:37:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:23 GMT