Re: [w3c/webcomponents] Support Custom Pseudo-elements (#300)

> As it’s comparable to what we have today:

That comparison doesn't really hold true for web components.  "User-agent-defined [classes]" (pseudo-classes) represent the target when it is in a particular state without modifying the attributes of the element. _Component authors_  have a requirement similar to this, as opposed to _page authors_ who are using the component.  Page authors expect that, when the internal state of an element changes (e.g. focus), its attributes do not (though its properties may).  A component author, therefore, wouldn't modify the class attribute of the custom element hosting its shadow tree.

In a similar vein, a component author might wish to define a "pseudo-element" to represent an internal part of the component, which they would do without modifying the host element in any observable manner.  A page author would just add a child element to the host.

```css
/* user-agent-defined state */
button:enabled

/* page author-defined state */
button.loading

/* component author-defined state */
x-button<???>

/* user-agent-defined pseudo-element */
foo::first-line

/* page author-defined element */
foo bar

/* component author-defined pseudo-element */
x-foo<???>
```

If you want to propose new syntax, you should rethink your premise for choosing `..` (which I don't really like, to be honest).

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/300#issuecomment-225151252

Received on Friday, 10 June 2016 10:44:34 UTC