Re: [css3-selectors]: Proposal: Adop the ::wrap pseudo element

19.10.2016, 05:48, "Florian Rivoal" <florian@rivoal.net>:
> * Pseudo elements are not in the DOM tree, but cause boxes to exist, and that's tricky to handle, especially when performance matters. It is already a non trivial issue for the existing pseudo elements like ::before and ::after, but the ::wrapper pseudo goes in the middle of the tree, not at the leaves, and that makes it harder.

Indeed, we already have pseudoelements that are not part of DOM tree, but are subject to apply styles, so the link between DOM and styleable things is already partially broken. Virtual containers would just require to make final transition from hard correspondence between DOM and stylable-things' tree to more generalized and flexible internal representation.

Not any change is possible to be made incrementally, sometimes a rather deep refactoring is needed, but that's what software development is actually about, and that's perfectly ok. It probably does not make much sense to implement solely simple things that everyone could easily implement.

> If an ::wrapper is introduced between a parent and a child element, do the child still count as a child of the original parent for selector matching purpose, or is it now a grand child and ::wrapper is the parent? ...

In terms of _selectors_ in CSS, once a wrapper is generated, the child now has two parents: the real parent and the generated virtual container. The real parent keeps being the parent regardless of how many levels of virtual containers are generated via CSS between them.

As for inheritance, that's probably a matter of a decision to be made just once, whatever the final decision is. We could inherit from virtual containers, or not, or even make it possible to specify explicitly for each virtual container whether its styles should be inherited.

Received on Wednesday, 19 October 2016 03:37:18 UTC