[csswg-drafts] [CSS2] computed value of line-height (#8385)

jfkthame has just created a new issue for https://github.com/w3c/csswg-drafts:

== [CSS2] computed value of line-height ==
The [CSS2 spec for the `line-height` property](https://w3c.github.io/csswg-drafts/css2/#propdef-line-height) says that its computed value is

> for [<length>](https://w3c.github.io/csswg-drafts/css2/#value-def-length) and [<percentage>](https://w3c.github.io/csswg-drafts/css2/#value-def-percentage) the absolute value; otherwise as specified

which implies that when `line-height` is specified as a <number>, we'd expect its computed value to be the same <number>.

However, none of the browsers I've tried seems to behave this way; they all return an absolute <length> for the computed `line-height`:

Safari:
```
document.body.style.lineHeight = "1.5"; window.getComputedStyle(document.body).lineHeight
"24px" = $1
```

Chrome:
```
document.body.style.lineHeight = "1.5"; window.getComputedStyle(document.body).lineHeight
'19.5px'
```

Firefox:
```
document.body.style.lineHeight = "1.5"; window.getComputedStyle(document.body).lineHeight
"24px"
```

Accordingly, should the spec be updated (or superseded by a new definition of `line-height` in CSS Text or CSS Fonts?) to reflect reality, or is this a bug in all the browsers?

(The only place I've actually seen a <number> returned for the computed value is in the `font` shorthand in Firefox:
```
document.body.style.font = "bold 12px/1.5 serif"; window.getComputedStyle(document.body).font 
"700 12px / 1.5 serif"
```
which is inconsistent with what it returns for the `line-height` longhand on the same computed style, and I propose to fix this in https://bugzilla.mozilla.org/show_bug.cgi?id=1813536.)


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8385 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 1 February 2023 12:36:46 UTC