Open Bug 1569292 Opened 2 years ago Updated 2 years ago

`+` CSS selector in combination with :empty in shadow DOM only refreshes when opening inspector

Categories

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

defect

Tracking

()

People

(Reporter: ntim, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

Testcase: https://nt1m.github.io/playground/shadow-dom-bug/

STR:

  • Click the button

Expected result:

  • "foo" and "bar" should be shown

Actual result:

  • only "foo" is shown

If you open devtools, then you get the expected result

Flags: needinfo?(emilio)
Blocks: shadowdom
Priority: -- → P3

mozregression brought me at bug 1410578, but I'm looking if I can reproduce using <style> instead of <link rel="stylesheet"> so I can provide a more useful regression range.

I'm otherwise getting https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=d3910b7628b8066d3f30d58b17b5824b05768854&tochange=515407ebfa1433c31144374313bbfd8b942af41

but before the regression range, I get this.attachShadow is undefined so I guess it's not that useful either.

Summary: `+` CSS selector in shadow DOM only refreshes when opening devtools → `+` CSS selector in shadow DOM only refreshes when opening inspector

FWIW, opening devtools just causes .bar to be restyled because devtools inject stylesheets in the page.

So the issue is that we hit the early return here, because the grand parent (the ShadowRoot) doesn't have the flags.

This is because of this code, which looks at parent_element and maybe should look at parent node.

Wrapping .foo and .bar under another element works around the issue. This is pretty similar to bug 1480746. I want to fix all these in bug 1480477, though maybe I can fix them earlier / separately.

Depends on: 1480477
Flags: needinfo?(emilio)
See Also: → 1480746

So the issue here is specific to :empty, as far as I can tell.

Summary: `+` CSS selector in shadow DOM only refreshes when opening inspector → `+` CSS selector in combination with :empty in shadow DOM only refreshes when opening inspector
You need to log in before you can comment on or make changes to this bug.