-
Notifications
You must be signed in to change notification settings - Fork 707
[css-images-4] Allow a single color stop with two positions #10077
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
svgeesus marked as non substantive for IPR from ash-nazg. |
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 cc @tabatkins thoughts? |
If you have a single color, any number of positions will produce the same thing (a solid-color gradient), so in theory that would be fine, but the current spec is just the most straightforward mapping of the earlier requirement (that you have at least two stops, so there's some notion of a "gradient" being defined) into the new ability for one stop to define two positions. If you just wanted a solid-color image, the intention is that you shouldn't reach for a gradient, but I don't really have an opinion on this, but since impls all seem to agree, I'm inclined to just accept Guillaume's PR as-is. |
I had not considered that browser vendors added support for a single color stop without a clear purpose. I thought it was an oversight in the spec. So the proposed change is substantive. Fwiw, I have a preference for Lea's suggestion, which requires a simpler syntax change. |
I just filed this issue so we can discuss there: #10092 But after enumerating the pros and cons, I think I'm pretty strongly in favor of dropping this restriction. |
@cdoublev Now that we have a resolution to drop that restriction, could you update the PR? Thanks! |
This reverts commit 607f1d5.
... with 0, 1, or 2 positions.
Great! I updated the changes. Should they also be applied in CSS Images 3? |
@LeaVerou this looks ok now, right? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Closing in favor of the reoslution from #10092 |
Fixes #10092.
I am not sure this remains an editorial change. I assume a single color stop defined with two positions was supposed to become valid at the time the syntax of (more than one) color stop defined with two positions was specified.
Chrome and FF (at least) supports this syntax, but it is not tested.
Maybe this sentence should also be updated: