fallback value in var()/attr() isn't detected as used/unused when var/attribute name is built from an ident() function
Categories
(DevTools :: Inspector: Rules, defect, P3)
Tracking
(Not tracked)
People
(Reporter: nchevobbe, Unassigned)
References
(Blocks 1 open bug)
Details
Steps to reproduce
- With support for
ident()(see patch in Bug 2088337) - Navigate to
data:text/html;charset=utf-8,<!doctype html><style>span {%0A%20 font-size: 48px;%0A%20 --x-1: gold;%0A%20 --x-2: tomato;%0A%20 color: var(ident("--x-" sibling-index())%2C lime);%0A}</style><body><span>A</span>%0A<span>B</span>%0A<span>C</span></body> - Inspect
A
Expected results
In the color declaration, lime should be struck through, as the fallback isn't used
Actual results
lime isn't struck through
Note that this might not be doable when the ident uses random()/random-item() (at least not in our current setup)
Comment 1•14 days ago
|
||
| frontend-triage | ||
output-parser.js takes the var() name only from the first Ident token. When the name is an ident() call, its parts belong to an aggregated child stack entry, so the loop breaks on the comma with no name and the fallback is never wrapped with unmatchedClass. #onCloseParenthesisForAttr has the same gap at #886-910, and in attr(ident(...) px, 0) it would take px as the attribute name.
Fix: Add an ident branch to #onCloseParenthesis, next to sibling-index at #572-577. It should join the arguments into the resolved name: the value of strings and idents, the text of integers, and a child's substitutedText. Leave the name unresolved for random() and similar. Then have the var and attr handlers take that ident() run as the name, wrapping all of its parts instead of splicing one, and bail as they do today when it is unresolved. Add cases to testParseVariable/testParseAttr in browser_outputparser.js and to browser_rules_sibling_functions_color.js, gated on layout.css.ident-function.enabled, which lands with bug 2088337.
Suggested severity: S4. The Rules view styles a fallback wrongly only for ident()-built names, a Nightly-only feature behind a pref, and the computed value is unaffected.
If you'd like to provide feedback on this comment, please use the 👍 or 👎 reaction.
If you want to categorize your feedback you can add one of the following tags: ai-triage-{wrong-file, wrong-cause, hallucination, out-of-scope, not-a-bug, wrong-fix, shallow-fix, wrong-severity}.
Needinfo hackbot@mozilla.tld to have a patch generated for this bug, include any questions or directions as needed in your comment.
| Reporter | ||
Updated•13 days ago
|
Description
•