CSS Warning message selector should be the desugared selector
Categories
(DevTools :: General, defect, P1)
Tracking
(firefox116 fixed)
| Tracking | Status | |
|---|---|---|
| firefox116 | --- | fixed |
People
(Reporter: nchevobbe, Assigned: nchevobbe)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
Steps to reproduce
- Navigate to
data:text/html,<meta charset=utf8><style>div { & span { color: blouge; background: cyan; }}</style><div><span>hello</span></div><span>world</span> - Open the console
- Enable the
CSSfilter if it wasn't the case - Expand the CSS warning tgo display impacted element
Expected results
In the displayed NodeList, there's only 1 impacted element (the span inside the div)
Actual results
There are 2 impacted elements (including the span outside the div)
| Assignee | ||
Updated•3 years ago
|
| Assignee | ||
Updated•3 years ago
|
| Assignee | ||
Updated•3 years ago
|
| Assignee | ||
Updated•3 years ago
|
Comment 1•3 years ago
|
||
Where do those impacted elements come from? I don't think we have code for that in platform.
| Assignee | ||
Comment 2•3 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #1)
Where do those impacted elements come from? I don't think we have code for that in platform.
We're using https://searchfox.org/mozilla-central/rev/4e8f62a231e71dc53eb50b6d74afca21d6b254e9/dom/bindings/nsIScriptError.idl#125-129 to execute a querySelectorAll on the document, which gets us the elements
We might keep cssSelectors as is since we display it , but we'd need the desugared selectors to be able to get the impacted elements
| Assignee | ||
Comment 3•3 years ago
|
||
Updated•3 years ago
|
Comment 4•3 years ago
|
||
So implementing the desugaring at that stage is quite tricky, because it makes CSS parsing slower, by making us keep track of the ancestor style rule selectors which we generally don't keep around.
| Assignee | ||
Comment 5•3 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #4)
So implementing the desugaring at that stage is quite tricky, because it makes CSS parsing slower, by making us keep track of the ancestor style rule selectors which we generally don't keep around.
Alright that's good to know. That's not something we want to have immediately anyway, the selector is only shown if you expand the message in the console.
Do you think we could have a cssRule property on nsIScriptError so DevTools can use that build the desugared selector with CssRule#domRule.selectorTextAt ?
| Assignee | ||
Updated•3 years ago
|
Comment 6•3 years ago
|
||
Hopefully this isn't too slow, and we only do this when error reporting
is enabled...
Comment 7•3 years ago
|
||
No, because at the point we emit the errors we still haven't built the rule, we're parsing the declarations. But I wrote a patch to expose the desugared selector, hopefully the extra bookkeeping doesn't show up in profiles, it being enabled only when error reporting.
Comment 10•3 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/beeb776a1819
https://hg.mozilla.org/mozilla-central/rev/f39f5b1e6230
Updated•3 years ago
|
Description
•