Gecko blockifies roots of detached subtrees.

RESOLVED WONTFIX

Status

()

P3
normal
RESOLVED WONTFIX
2 years ago
9 months ago

People

(Reporter: emilio, Unassigned)

Tracking

(Blocks: 2 bugs, {dev-doc-complete})

unspecified
dev-doc-complete
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox57 wontfix)

Details

(Whiteboard: [stylo])

(Reporter)

Description

2 years ago
I think there's no spec that requires this, and that this is just a result of how blockification for the root element is implemented in Gecko.

The following test case:

<!doctype html>
<style>
:root { font-size: 100px; }
</style>
<script>
let detached = document.createElement('div');
detached.style.display = "inline";
detached.style.fontSize = "1rem";
alert(getComputedStyle(detached).display);
alert(getComputedStyle(detached).fontSize);
</script>

Alerts "block" on current stylo and Gecko, but it alerts "inline" with my patch from bug 1374062, which is correct per my reading of the spec.

From https://drafts.csswg.org/css-display/#transformations:

> The root element’s display type is always blockified. Additionally, a display of contents computes to block on the root element.

But there's no mention of any other node, so I think it shouldn't get blockified.

There's a similar problem with rem units. In that test-case, stylo alerts "100px" with my patches, but gecko alerts "16px", which feels also wrong.
(Reporter)

Updated

2 years ago
Blocks: 1243581, 1365771
(Reporter)

Comment 1

2 years ago
This is also an issue with ::backdrop. Stylo respects rem units on backdrop, but Gecko doesn't.
The question is what is "the root element"?  The CSS spec never defines the term, and in general seems to think that selectors are only being applied to elements that are in a document tree...

Please file spec issues to get all this stuff clarified.
In terms of other browser behavior:

1)  Safari and Chrome both return empty string for both of the computed style gets.
2)  Edge returns "inline" and "16px".

Interop, what?  Please do file those spec issues.  :(
(Reporter)

Comment 4

2 years ago
ni so I don't forget, I'm not on my computer right now.
Flags: needinfo?(emilio+bugs)
Whiteboard: [stylo]
Priority: -- → P3
Marking as part of documentation plan for intentional stylo differences
Keywords: dev-doc-needed
Documented:

https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement#Browser_compatibility (if the Quantum CSS notes section doesn't appear for you, try Shift Refreshing the page.)
https://developer.mozilla.org/en-US/Firefox/Releases/57#Quantum_CSS_notes
Keywords: dev-doc-needed → dev-doc-complete
emilio, are there any code changes planned here?  (It sounds like this was sort of a bug in Gecko which we're fixing with stylo, right?)

Given that, I think this is wontfix for 57 (and perhaps wontfix forever?)
status-firefox57: --- → wontfix
Flags: needinfo?(emilio)
(Reporter)

Comment 9

2 years ago
Yeah, I don't think this is worth fixing on the old style system.
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Flags: needinfo?(emilio)
Resolution: --- → WONTFIX
(Reporter)

Updated

9 months ago
Duplicate of this bug: 698844
You need to log in before you can comment on or make changes to this bug.