[csswg-drafts] [css-shadow-parts] Expose parts programmatically

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

== [css-shadow-parts] Expose parts programmatically ==
It would be helpful for components with parts to expose those parts in some way that's programmatically inspectable.

For components with an open shadow root, someone could query inside the shadow for elements that have a `part` attribute, but this is not possible for components with closed shadow roots. To avoid leaking shadow elements, the proposed mechanism would return an array of string part names, not elements.

This would be akin to property reflection, and good for things like design/debugging/testing tools. E.g., it'd be nice if a tool could ask a DOM element what parts it has so that the tool can show the user a list of the parts available for styling.

Using the spec's example:

```html
<template id="c-e-template">
  <span part="textspan">This text will be red</span>
</template>
```

The goal would be to allow something like:

```js
const e = document.createElement('custom-element');
e.parts; // Returns the array ['textspan']
```


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

Received on Friday, 19 October 2018 18:43:03 UTC