[csswg-drafts] [css-content][css-pseudo][css-cascade] Does content:contents in pseudo affect inheritance?

Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-content][css-pseudo][css-cascade] Does content:contents in pseudo affect inheritance? ==
[CSS Content](https://drafts.csswg.org/css-content/#element-content) allows to move the actual contents of an element into the ::before or ::after pseudo-element.

How does this affect inheritance? Do the actual contents of the element still inherit from the element, or do they inherit from the pseudo-element?

For example:

div {
  content: none;
  color: red;
div::before {
  content: contents;
  color: green;

Should Foo be green or red? On the one hand, [CSS Cascade](https://drafts.csswg.org/css-cascade-4/#inheritance) says

> Note: Inheritance follows the document tree and is not intercepted by anonymous boxes, or otherwise affected by manipulations of the box tree.

so maybe the span should inherit from the div and be red. On the other hand, [CSS Pseudo](https://drafts.csswg.org/css-pseudo-4/#generated-content) says

> these pseudo-elements generate boxes as if they were immediate children of their originating element, and can be styled exactly like any normal document-sourced element in the document tree.

Personally I would expect green, like if I had used `content: "Foo"` instead of `content: contents`.
As far as I know, there is no implementation of this to test.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1195 using your GitHub account

Received on Sunday, 9 April 2017 23:39:25 UTC