Bug 110062 - Web Inspector: RuleMatch.matchingSelectors is misleading
Summary: Web Inspector: RuleMatch.matchingSelectors is misleading
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-02-17 13:41 PST by Timothy Hatcher
Modified: 2016-12-13 15:36 PST (History)
11 users (show)

See Also:


Attachments
Test Case (143 bytes, text/html)
2013-02-17 13:41 PST, Timothy Hatcher
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Hatcher 2013-02-17 13:41:25 PST
Created attachment 188774 [details]
Test Case

The matchingSelectors array can be misleading in the UI. If you have a rule with multiple selectors, one specific and one less specific. Then a separate rule that is in the middle of those matches. The first and last matches will both highlight the two selectors, when I would expect only the one selector that matched at that time to be highlighted.

See attached test case. I only expect "#foo" to be highlighted the 1st match, and "div" to be highlighted on the 3rd match.
Comment 1 Timothy Hatcher 2013-02-17 13:53:43 PST
This happens because InspectorCSSAgent::buildArrayForMatchedRuleList asks if the selectors match after the resolver has made the rule list. The resolver should tell us per rule match what selector matched. I think it should only ever be one selector per match, so the current API of matchingSelectors being an array might just need to be matchingSelectorIndex.
Comment 2 Radar WebKit Bug Importer 2014-12-01 14:04:25 PST
<rdar://problem/19106456>