Closed Bug 730280 Opened 13 years ago Closed 13 years ago

API to list matching rules with their specificity

Categories

(Core :: DOM: CSS Object Model, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: miker, Unassigned)

References

Details

In the developer tools style tools (specifically the style doctor, rule and calculated views) we need access to the specificity of each CSSSelector. In the style doctor the displayed value could help users to diagnose why a selector is not applied to an element, in the other tools we use it to decide in which order we display the rules. In order to achieve this we need an API. I would suggest that nsIDOMCSSRule exposes the specificities with which the rules are matched (since there it is unique). Of course, we don't currently have that information ... though we do need it for bug 561154.
Er... nsIDOMCSSRule doesn't have a unique specificity, so I'm not sure I understand the second paragraph of comment 0.
Hmm ... I see, even cssStyleRule.cssText can contain multiple selectors so there is no place that the specificity for a particular selector could be exposed.
It could be exposed in an API that says which rules matched, since when a rule matches it's a particular selector that's matching, with a particular specificity.
That could work, something like domRules.getCSSSelectors(aRule).
Summary: Expose CSS Rule specificity value through nsIDOMCSSRule → API to list matching rules with their specificity
This is fixed as part of another bug
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.