Closed Bug 1664511 Opened 4 years ago Closed 2 years ago

Get unique selector before creating the DOM for a CSS Rule in the Rules view

Categories

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

defect

Tracking

(firefox108 fixed)

RESOLVED FIXED
108 Branch
Tracking Status
firefox108 --- fixed

People

(Reporter: rcaliman, Assigned: jdescottes)

Details

Attachments

(2 files)

The RuleEditor._create() operation is synchronous. It generates the DOM for the CSS Rule.

While preparing to build the selector fragment, there is a nested async operation to get the uniqueSelector() of a style rule which doesn't have a proper CSS selector text, like style rules from inline style attributes.

https://searchfox.org/mozilla-central/rev/5d45da52f2fa423c9f4505ede5d1a5c7d48163fc/devtools/client/inspector/rules/views/rule-editor.js#162-175

The nested async expression is odd. It breaks the expectations of tests that DOM here is produced synchronously.
We should find a way to keep the entire body of RuleEditor._create() synchronous.
Perhaps compute the unique selector higher in the chain, when getting rules from the server, but before rendering them?

Summary: Get unique selector before creating the DOM of a CSS Rule → Get unique selector before creating the DOM for a CSS Rule in the Rules view
Attached image image.png

Note that this unexpected async operation also leads the highlighter icon to be positioned differently for the "element" entry compared to the regular selectors.

Moving to defect as this is at least a visual / UI bug.

Severity: -- → S3
Type: task → defect
Priority: -- → P3

unique selectors for inline and inherited inline rules will be retrieved on demand.

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1283037f6210
[devtools] Resolve inline & inherited-inline selectors for rule-editor on demand r=nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: