Status of pseudo-elements is unclear
| Project: | EPUB Maintenance |
| Component: | Open Publication Structure (OPS) |
| Category: | bug report |
| Priority: | normal |
| Assigned: | PSorotokin |
| Status: | completed @ 2.0.1 |
Jump to:
In the OPS 2.0 final spec, it is unclear whether CSS pseudo-element selectors are a required part of the specification. Section 3.1 does say that "reading systems must support all CSS2 selectors", and CSS2 pseudo-elements seem to be classed as selectors in the CSS2 documentation, appearing alongside other selections in section 5.
However, there's the peculiarity that in OPS 2.0, section 3.3, the :left, :right and :first pseudo-elements applicable to the @page property are explicitly listed in the table of required properties and values, although no other selectors are listed there.
It seems to me that pseudo-elements ought to be a required part of the spec, but clarification either way would be good.
Replace last line of section 3.1 with:
Reading Systems must support all CSS2 selectors, including pseudo-elements and pseudo-classes. However, certain pseudo-classes may not be applicable to all Reading Systems (e.g. 'hover' for devices with a touch screen) and may not result in any rendering on such devices.
CSS specification defines the behavior of lang pseudo-class, but leaves the definition
of the language identifier assigned to each element to the mark-up specification.
For OPS documents, language identifier of an element can be determined in the following
fashion:
- If an element has xml:lang attribute specified, value of that attribute is element's
language identifier - Otherwise, normal XML processing of ancestors must be used to determine the language identifier.
- Otherwise (top-level element), element's language identifier is taken from the
first Dublin Core language metadata element from the publication's OPF file.
- Login to post comments

Comments
#1
Being required is the way I always have read the specification and recall the intent. But, if it's unclear we could add a "(including pseudo classes and elements)" when we reference required support for CSS2 selectors.
#2
I suppose the other reason it's become an issue is that the major current implementation of an ePub reader (ADE) doesn't support pseudo-elements.
#3
I think the @page pseudo-classes are explicitly listed since they are not in the selectors section of CSS 2, so it was not considered enough to fall under a blanket statement about selectors. So, the confusion arises from the clarification. We could add language about pseudo-elements/classes explicitly, though I wonder what confusion that will cause?
#4
This was discussed on the WG call last week. The decision was to make explicit that pseudo-elements/classes are required. Peter will draft a sentence or two for the "resolution" with a comment about using lang() in practice. When that is posted/agreed, this issue should be moved to "accepted" status and I will insert the text into the next version of the 2.0.1 draft for review.
#5
To be moved to "accepted" (for 2.0.1), see Resolution text.
#6
Proposed language for :lang selector:
CSS specification defines the behavior of lang pseudo-class, but leaves the definition of the language identifier assigned to each element to the mark-up specification. For OPS documents, language identifier of an element can be determined in the following fashion:
1. If an element has xml:lang attribute specified, value of that attribute is element's language identifier
2. Otherwise, if an element has a parent, element's language identifier is the same as its parent's language identifier
3. Otherwise (top-level element), element's language identifier is taken from the first Dublin Core language metadata element from the publication's OPF file.
#7
The proposed resolution seems clear on how to interpret the :lang pseudo-class. But so far no text has been proposed to clarify the status of pseud-elements such as :first-letter.
#8
The final text will be reflective of comment #4 -- support for pseudo elements/classes is required.
#9
#10