-
Notifications
You must be signed in to change notification settings - Fork 704
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
[css-overflow-4] How do -webkit-line-clamp
and line-clamp
interact when both are specified?
#10439
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. |
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: