Errata: pseudo-elements in document hierarchy

CSS1, CSS2, and the CSS3 selectors working draft have incorrect 
examples of incorporating a pseudo-element into the document's 
element hierarchy.  CSS1:2.6 (<http://www.w3.org/TR/REC-CSS1#multipl
e-pseudo-elements>), CSS2:5.12.1 (<http://www.w3.org/TR/REC-CSS
2/selector.html#first-line-pseudo>), and CSS3 Selectors:7.1 
(<http://www.w3.org/TR/2001/WD-css3-selectors-20010126#first-line>) 
show that a 'first-line' pseudo-element contains a true element.

To be effective within the regime of the cascade and inheritance, the 
typographical pseudo-elements need to be leaf nodes or to contain only 
pseudo-elements.

Observe the incorrect example from CSS1:

<P>
<P:first-line>
<SPAN> 
This text is inside a long 
</SPAN>
</P:first-line>
<SPAN> 
span element 
</SPAN>

This should instead be as follows.

<P>
<SPAN> 
<P:first-line>
This text is inside a long 
</P:first-line>
span element 
</SPAN>

I have devised a more complicated example:

<html>
<body>
<p>
<span>The first <em>four</em> words fall on the first</span> line of 
this paragraph.
</p>
</body>
</html>

becomes

<html>
<body>
<p>
<span><html:first-line><body:first-line><p:first-line
 ><html:first-letter><body:first-letter><p:first-letter
 >T</p:first-letter></body:first-letter></html:first-letter
 >he first <em><html:first-line><body:first-line><p:first-line
 >four</p:first-line></body:first-line></html:first-line></em
 > words</p:first-line></body:first-line></html:first-line>
 fall on the first</span> line of this paragraph.
</p>
</body>
</html>

For those who find ASCII art more palatable than tag soup, the 
hierarchy

html
|-body
  |-p
  | |-span
  |   |-"The first "
  |   |-em
  |   | |-"four"
  |   |-"words fall on the first"
  |-" line of this paragraph."

becomes the hierarchy

html
|-body
  |-p
  | |-span
  |   |-html:first-line
  |   | |-body:first-line
  |   |  |-p:first-line
  |   |     |-html:first-letter
  |   |     | |-body:first-letter
  |   |     |   |-p:first-letter
  |   |     |     |-"T"
  |   |     |-"he first "
  |   |-em
  |   | |-html:first-line
  |   |   |-body:first-line
  |   |     |-p:first-line
  |   |       |-"four"
  |   |-html:first-line
  |   | |-body:first-line
  |   |   |-p:first-line
  |   |     |-"words"
  |   |-" fall on the first"
  |-" line of this paragraph."    

This hierarchy produces the desired and expected results.

-- 
Etan Wexler

Received on Monday, 19 November 2001 12:52:26 UTC