[csswg-drafts] [css-shadow-parts] Access control (#3506)

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

== [css-shadow-parts] Access control ==
(Split from issue #3467, reported by @stefsullrew)

It would be very useful if it was possible to limit access to CSS rules for a defined part. The purpose is to limit the styling API of a component by only allowing certain things to be overridden or to lock down certain things that should never be overridden.

In the example below “part='title'” is defined but only “color” and “background-color” can be overridden, all other rules would be ignored.

We envision allow all by default with the possibility to allow or deny specific lists of CSS rules.

```
<x-foo>
    <h2 part="title" part-allow="color, background-color">Access control</h2>
    <slot></slot>
</x-foo>
```

```
x-foo::part(title) {
    color: purple; // allowed
    bacgkround-color: grey; // allowed
    height: 100%; // denied
}
```

In the example below “part='title'” is defined but “color” and “background-color” are locked, all other rules would apply and override the component's default styles.

```
<x-foo>
    <h2 part="title" part-deny="color, background-color">Access control</h2>
    <slot></slot>
</x-foo>
```

```
x-foo::part(title) {
    color: purple; // denied
    background-color: grey; // denied
    height: 100%; // allowed
}
```



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

Received on Monday, 14 January 2019 02:58:54 UTC