-
Notifications
You must be signed in to change notification settings - Fork 719
[css-overflow-4] How do -webkit-line-clamp
and line-clamp
interact when both are specified?
#10439
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
Comments
That doesn't bother me: there really isn't a point in going around setting
I think it's more typical for CSS to have the cascade order determine the winner.
You could do that, but conditional shorthands seem unusual. Might be tricky to implement. I think the following alternative would work, without the full set of longhands: You could have some simplified version of the longhands, not exposed to web authors. One would have to be cc: @fantasai |
Note that we need to expand shorthands into longhands at parse time, but we may not know the value of Also I don't think a property should sometimes be a longhand and sometimes a shorthand, that would be problematic e.g. because Like Florian says I think it's fine if |
There is a 4% of page loads where But maybe making sure that the devtools show indications about this would be enough to make this not an issue. |
The CSS Working Group just discussed
The full IRC log of that discussion |
We didn't discuss how the Do we want to make this an async resolution? |
I just realized that if an element has I wonder if, given this, we might want to make |
@andreubotella @andruud Is that a significant risk for this property in particular, or just generally a concern to think about? |
I don't think the risk is significantly higher than for other properties that have been implemented as longhands for a long time, and in fact it might be lower because of the fact that it's vendor-prefixed. So it's more about the general concern. Something that should also be part of the discussion, though, is that unprefixed |
Unless there is specific evidence of breakage, I think this remains the right thing to do. Systematically avoiding shorthandification seems to extreme to me, and blocks a rare and significant means of extending and evolving the language. I guess that it's not safe in all cases, but I think it's worth doing here (unless we know of something specific that breaks) |
So we have two questions to solve here:
I'd like to hear some answers to both of these questions, to hopefully make this an async resolution. |
* [css-overflow-4] Draft spec for `continue: collapse` (#7708) * Clarification about float clearance in the automatic block size * Update to only allow clamping after a line * Apply suggestions from code review Co-authored-by: Florian Rivoal* Update css-overflow-4/Overview.bs Co-authored-by: Florian Rivoal * Update css-overflow-4/Overview.bs * Update css-overflow-4/Overview.bs * Update css-overflow-4/Overview.bs * Update css-overflow-4/Overview.bs * Update css-overflow-4/Overview.bs * Update for #10439 * Update for #11962 * Update for #10868 --------- Co-authored-by: Florian Rivoal Co-authored-by: Tab Atkins Jr.
I'd say yes
I'd say yes. On top of that, we had said several years ago that we were choosing not to expose the longhangs to keep ourselves some flexibility in case we wanted to change their name or syntax. In the meanwhile, there's been significant rework of the proposal (with the introduction of Also, one more question: I don't care strongly either way, but it's a choice we now have, so I thought I'd ask. |
Uh oh!
There was an error while loading. Please reload this page.
In the current spec text for css-overflow-4, which only describes
continue: discard
(not yetcontinue: collapse
as described in #7708), bothline-clamp
and the legacy-webkit-line-clamp
property are shorthands for other properties, includingmax-lines
. This means that if both are specified on some element, whichever wins in the cascade will be applied.However, this leads to unexpected results. Consider the following:
Since
line-clamp
and-webkit-line-clamp
are shorthands for the same set of properties,-webkit-line-clamp
will win. This means thatmax-lines
will have a specified value of4
, but also thatcontinue
will have a specified value of-webkit-discard
– which will cause thecontinue
property (and by extension,max-lines
) to not take effect, becausedisplay
is not set to-webkit-box
.My current implementation of
continue: collapse
in Blink (see #7708) implements bothline-clamp
and-webkit-line-clamp
as longhands which don't alias. If both are present (and not specified tonone
) on some box,line-clamp
wins. AFAIU this behavior wouldn't be possible to specify while making(-webkit-)line-clamp
shorthands, unless we make a separate-webkit-max-lines
property.If we want to keep the shorthands, while making the code above actually work, my understanding is that
-webkit-line-clamp
would have to be specified such that it sets the longhands ifdisplay: -webkit-box
and-webkit-box-orient: vertical
are set, and to not be a shorthand for anything otherwise.cc @frivoal
The text was updated successfully, but these errors were encountered: