Inconsistent computed-style serialization of line-height vs font shorthand
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox111 | --- | fixed |
People
(Reporter: jfkthame, Assigned: jfkthame)
References
Details
Attachments
(1 file)
This Firefox behavior seems a little odd to me:
> document.body.style.font = "bold 10px / 1.5 serif"
< "bold 10px / 1.5 serif"
> window.getComputedStyle(document.body).font
< "700 10px / 1.5 serif"
> window.getComputedStyle(document.body).lineHeight
< "15px"
Note that the line-height value, specified in the shorthand as 1.5
, has been serialized as 1.5
in the font
shorthand of the computed style, but as 15px
in the longhand line-height property.
In contrast, Chrome serializes it as 15px
in both the shorthand and longhand, which is at least consistent.
(Safari also serializes the line height as 15px
in both cases, although it has other issues with the shorthand...)
AFAICS from the CSS2 spec for line-height
, the computed value is supposed to be "for <length> and <percentage> the absolute value; otherwise as specified", which would seem to imply that 1.5
would be the expected computed value; but the only place I see this is in the Firefox version of the shorthand; everywhere else, it is resolved to the absolute value 15px
.
So maybe that spec is obsolete and we should just converge on using the absolute value? The current inconsistency seems undesirable.
(And presumably the spec for line-height
should be updated and moved to a newer spec, but currently everything seems to refer back to CSS2.)
Updated•4 months ago
|
Assignee | ||
Comment 1•4 months ago
|
||
This makes the serialization of the 'font' shorthand on computed style return the line-height
as an absolute length rather than a number (font-size multiplier), which is consistent with
what the line-height longhand already returns, and with other browsers.
(See also https://github.com/w3c/csswg-drafts/issues/8385.)
Updated•4 months ago
|
Updated•4 months ago
|
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/481e2ec41b3a Resolve <number> to <length> in ToResolvedValue for line-height. r=emilio
Comment 3•4 months ago
|
||
bugherder |
Description
•