[csswg-drafts] [css-images] Clarify how gradients should be serialized in presence of the double-position color syntax

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

== [css-images] Clarify how gradients should be serialized in presence of the double-position color syntax ==
Current behavior is:

```js
document.body.style.backgroundImage = "linear-gradient(black 0%, black 50%)"
"linear-gradient(black 0%, black 50%)";
document.body.style.backgroundImage // "linear-gradient(black 0%, black 50%)"
"linear-gradient(black 0%, black 50%)"
```

I'd expect that behavior to be preserved in presence of the double-position stop syntax, but right now in Blink's implementation that returns:

```
"linear-gradient(black 0% 50%)"
```

I think defining how gradients serialize in presence of this syntax is worth doing before implementations ships this.

There would be three options IIUC:

### Keep the gradient as-specified.

This would be the nicest IMO, since it doesn't break old code and allows the new syntax.

### Canonicalize gradients if possible.

This is what Blink does. This would be OK if we deem the compact impact is not relevant / enough, though then the algorithm to canonicalize them needs to be defined and tested.

### Never canonicalize gradients.

All gradients would serialize with the "expanded" syntax. I'd be ok-ish with this, though it may not be that great.

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

Received on Monday, 28 May 2018 09:53:54 UTC