Closed Bug 1874705 Opened 8 months ago Closed 8 months ago

CSS pseudo class :has in combination with HTMLTemplateElement

Categories

(Core :: CSS Parsing and Computation, defect)

Firefox 121
defect

Tracking

()

VERIFIED FIXED
123 Branch
Tracking Status
firefox123 --- verified
firefox124 --- verified

People

(Reporter: pascalav, Assigned: dshin)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Steps to reproduce:

You can simulate the bug(?) with JSFiddle click by click.

Both examples show the error in the Firefox browser under Kubuntu (Snap version 121.0.1-1). Once with document.createElement('template') and once with the template tag in the body. The result is the same.

https://jsfiddle.net/o5fuztr0/1/
or
https://jsfiddle.net/o5fuztr0/

User-Agent: "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0"

Actual results:

If you use the CSS pseudo class :has in combination with templates, the CSS property is not updated when the template is inserted into the DOM.

Expected results:

The stored CSS properties should be displayed. In the example here the background color. However, this applies to all properties. Also display: none etc.

Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core
Flags: needinfo?(dshin)

Thanks for filing!

Minimum reproducible case for the root cause attached.
Root cause is here where in a multiple append scenario, we skip invalidation if the first node is not an element.

Flags: needinfo?(dshin)
Severity: -- → S3
Assignee: nobody → dshin
Status: UNCONFIRMED → NEW
Ever confirmed: true
Blocks: has-issues
Pushed by dshin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/46d015f0153a Run invalidation on appended elements even if the first node is not an element. r=firefox-style-system-reviewers,emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/44019 for changes under testing/web-platform/tests
Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch
Upstream PR merged by moz-wptsync-bot
Upstream PR merged by moz-wptsync-bot
QA Whiteboard: [qa-123b-p2]

Reproducible on a 2024-01-15 Nightly build on macOS 12.
Verified as fixed on Firefox 123.0 and Firefox Nightly 124.0a1 on Windows 10, Ubuntu 22, macOS 12.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-123b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: