Open Loirooriol opened 7 years ago
The existence and position of pseudo-elements in the tree is defined in Selectors L3 / CSS Pseudo-elements L4.
What aspects of the DOM are expected to be rendered is probably more a question for the DOM spec than for CSS: e.g. it should be their decision that child text nodes of elements should be rendered, but the contents of a comment node or processing instruction should not.
CSS can in theory render all of it, but not being rendered is what makes a comment a comment--so that shouldn't be our decision.
Well I don't mind if the decision of which CharacterData nodes should be rendered is deferred to the DOM spec. But I would like if all the algorithms for obtaining each tree from the previous one (DOM tree, flat tree, element tree, box tree, fragment tree) would be described in a single place. Possibly linking to some spec for details, like https://drafts.csswg.org/css-scoping/#flattening, which seems the only proper tree algorithm.
The Working Group just discussed Clarify element tree definition
, and agreed to the following:
RESOLVED: Defer #1810 and #2365 to later
CSS Display says
This is confusing because the source document is organized as a DOM tree of DOM nodes. Not just elements and text nodes.
As far as I know, the CSS element tree is derived from the DOM tree as follows:
::before
pseudo-element is inserted as the first child of each element node.::after
pseudo-element is inserted as the last child of each element node.::marker
pseudo-element is inserted at some places (to be exactly determined in #1793).All of this should be properly defined in the spec.