Closed Bug 2013327 Opened 4 months ago Closed 4 months ago

[computed panel] wrong matched selector order when rule applying on parent element is important

Categories

(DevTools :: Inspector, defect)

defect

Tracking

(firefox149 fixed)

RESOLVED FIXED
149 Branch
Tracking Status
firefox149 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

Details

Attachments

(3 files)

Attached file test case

Steps to reproduce

  1. Open attached test case
  2. Open the inspector
  3. Select the <h1>::after node in the markup view
  4. Select the computed panel
  5. Expand the color property to see matched selectors

Expected results

I'm seeing 2 matched selectors in this order:

  • h1::after > red
  • h1 > blue

Actual results

The selectors are not in the right order:

  • h1 > blue`
  • h1::after > red

Note that this is not restricted to pseudo element, we have the same issue if an inherited rule has an important priority while the rule applying on the element does not (but it should still win)

Summary: [computed panel] wrong matched selector order when pseudo element is selected and binding element rule declaration is important → [computed panel] wrong matched selector order when rule applying on parent element is important

The distance property indicates if the selector applies to the element or to an ancestor (in such case, it is
negative and reflect how many level there is between the ancestor and the viewed element).
We need to use this when comparing those selectors, as an inherited declaration, even if important, can't
override a direct declaration.

A test case is added in browser_computed_matched-selectors-order.

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Pushed by nchevobbe@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/66677c72a60d https://hg.mozilla.org/integration/autoland/rev/00b1fc551b60 [devtools] Consider selector distance in CssSelectorInfo#compareTo. r=devtools-reviewers,jdescottes.
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 149 Branch
QA Whiteboard: [qa-triage-done-c150/b149]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: