DevTools shows incorrect applied CSS in Styles panel when using layers and !important
Categories
(DevTools :: Inspector: Rules, defect)
Tracking
(firefox137 fixed)
Tracking | Status | |
---|---|---|
firefox137 | --- | fixed |
People
(Reporter: chriskirknielsen, Assigned: nchevobbe)
References
()
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:134.0) Gecko/20100101 Firefox/134.0
Steps to reproduce:
- Create an element with an inline style set to important
- Create a
<style>
with a layer that sets the same property as inline, but to a different value, also using important (e.g.:<p style="color: blue !important">
and @layer { p { color: red !important; }}`) - Inspect the element via DevTools and compare the Styles panel and Computed panel reported values
Live demo: https://codepen.io/chriskirknielsen/pen/yyBdXPo?editors=0100
Actual results:
The Styles panel and Computed panel report a different "winning" style value.
Expected results:
The Styles and Computed panels should report the same style value.
Comment 1•5 months ago
|
||
The Bugbug bot thinks this bug should belong to the 'DevTools::Inspector' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Assignee | ||
Comment 2•5 months ago
|
||
Thanks for the report. I thought we handled those cases correctly in Bug 1824652, but I guess I missed this
Assignee | ||
Comment 3•5 months ago
|
||
From https://www.w3.org/TR/css-cascade-5/#style-attr:
declarations that are attached directly to an element (such as the contents
of a style attribute) rather than indirectly mapped by means of a style rule
selector take precedence over declarations the same importance that are mapped
via style rule.
this comes before the layer ordering, so an important property in the style
attribute will always win against an important property in a layer rule (which
differs from "regular" rules, where important property in layer wins over
important property not in a layer)
Updated•5 months ago
|
Comment 5•5 months ago
|
||
bugherder |
Description
•