Closed Bug 1838163 Opened 11 months ago Closed 11 months ago

Selector highlighter doesn't work for nested rules

Categories

(DevTools :: Inspector: Rules, defect, P1)

defect

Tracking

(firefox116 fixed)

RESOLVED FIXED
116 Branch
Tracking Status
firefox116 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

References

(Blocks 2 open bugs)

Details

Attachments

(2 files)

If you have the following

body {
  & main {
    …
  }
}

clicking on the highlighter icon next to main won't highlight the <main> element.


It looks like this is because we're using the rule selector directly (& main), but & can't be used to query an element, we need to substitute it with the parent selector (and if the parent selector also has &, we need to substitute it with its parent selector as well, and so on)

From the spec (https://www.w3.org/TR/css-nesting-1/#nest-selector) :

The nesting selector can be desugared by replacing it with the parent style rule’s selector, wrapped in an :is() selector.

So for our case, & main should be turned into :is(body) main

Priority: -- → P1
Severity: -- → S3
Assignee: nobody → nchevobbe
Attachment #9340227 - Attachment description: WIP: Bug 1838163 - [devtools] Use desugared selector for selector highlighter. → Bug 1838163 - [devtools] Use desugared selector for selector highlighter. r=#devtools-reviewers
Status: NEW → ASSIGNED
Attachment #9340227 - Attachment description: Bug 1838163 - [devtools] Use desugared selector for selector highlighter. r=#devtools-reviewers → WIP: Bug 1838163 - [devtools] Use desugared selector for selector highlighter.
Attachment #9340227 - Attachment description: WIP: Bug 1838163 - [devtools] Use desugared selector for selector highlighter. → Bug 1838163 - [devtools] Use desugared selector for selector highlighter. r=#devtools-reviewers
Attachment #9340445 - Attachment is obsolete: true
Attachment #9340445 - Attachment is obsolete: false
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/64a5444bc816
[devtools] Expose desugared selectors on style rule actor. r=ochameau.
https://hg.mozilla.org/integration/autoland/rev/a6f44dc492b0
[devtools] Use desugared selector for selector highlighter. r=ochameau
Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 116 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: