Closed Bug 1374994 Opened 7 years ago Closed 7 years ago

Gecko blockifies roots of detached subtrees.

Categories

(Core :: CSS Parsing and Computation, defect, P3)

defect

Tracking

()

RESOLVED WONTFIX
Tracking Status
firefox57 --- wontfix

People

(Reporter: emilio, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, Whiteboard: [stylo])

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.
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.  :(
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
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?)
Flags: needinfo?(emilio)
Yeah, I don't think this is worth fixing on the old style system.
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: needinfo?(emilio)
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.