Re: [csswg-drafts] [css-cascade] Additive CSS (#1594)

If additive behaviour was defined on a per-property basis it could apply even where lists of items aren't natural - for example:
```html
<style>
.disabled {
    text-decoration: line-through !add;
}
a {
   text-decoration: underline !add;
}
</style>
<a class="disabled">underlined and struck-out</a>
```
or, slightly more hypothetically:
```html
<style>
p {
    text-spacing: trim-adjacent-to-punctuation; /* a made-up value */
}
:lang(fr) {
   text-spacing: punctuation !add;
}
</style>
/* Remove spacing around the colon AND insert a 1/4 nbsp before */
<p lang="fr">Punctuation : le colon</p>
```
Various forms of text "fix up" keep being proposed[1][2][3], and additive behaviour seems like a good option for what will inevitably become an increasingly long list.

For font-feature-settings too. Here, I was wondering how you might offer more control over the cascade than just "add to, rather than replace, the previous matched value"

```css
p {
    font-feature-settings: "ss01" !name swash;
}
.fancy {
    font-feature-settings: "ss02" !add; /* gets "ss01", "ss02" */
}
.noswash {
    font-feature-settings: inherit !remove swash; /* gets "ss02" */
}
```
This would require each declaration has a name field, but beyond that should be no harder than the vanilla "!add" proposal.

[1] https://www.w3.org/TR/css-text-4/#text-spacing-property
[2] https://www.w3.org/Style/2013/paged-media-tasks#text-fix
[3] https://www.princexml.com/doc/css-props/#prop-prince-text-replace

-- 
GitHub Notification of comment by faceless2
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1594#issuecomment-564524905 using your GitHub account

Received on Wednesday, 11 December 2019 12:48:52 UTC