[css-images-4] Allow a single color stop with two positions by cdoublev · Pull Request #10077 · w3c/csswg-drafts (original) (raw)
Hey, thanks for working on this! Long overdue!
Here are some tests: https://codepen.io/leaverou/pen/eYodMoj (if anyone can port them to WPT after this is merged, that would be great)
And yes, the two position syntax works everywhere. Safari as well, just tested. No browser seems to support one or zero positions.
Looking at the change, it's a little unfortunate we have to define new separate tokens just to make sure that if we have a single color stop it has two positions. And it makes me wonder why do we actually need to enforce this. What purpose does it serve? What's the harm in simply allowing a single color stop, even if it has one position — or even none? You get a single color anyway, and allowing these would provide a smoother authoring experience for editors offering realtime updates. Even with the two color stop positions, you can specify both to be equal, so can't we just spec that a single position expands to that, and no position expands to 0% 100%
or something? If anything, when you have a single color stop no position makes more sense!
cc @tabatkins thoughts?