Open Bug 1838172 Opened 3 years ago Updated 3 years ago

selector highlighter doesn't work for nested rules in style editor

Categories

(DevTools :: Style Editor, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: nchevobbe, Unassigned)

References

(Blocks 1 open bug)

Details

Steps to reproduce

  1. Navigate to data:text/html,<meta charset=utf8><style>body { & h1 { color: gold; }}</style><h1>Hello</h1>
  2. Open the style editor
  3. Hover the & h1 token in the editor

Expected results

The element is highlighted in the page

Actual results

Highlighter is never displayed


It may be because we're using the rule selector directly (& h1), 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) h1

Priority: -- → P3
Severity: -- → S3
You need to log in before you can comment on or make changes to this bug.