Bug 110062

Summary: Web Inspector: RuleMatch.matchingSelectors is misleading
Product: WebKit Reporter: Timothy Hatcher <timothy>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: apavlov, graouts, inspector-bugzilla-changes, keishi, loislo, pfeldman, pmuellr, vsevik, web-inspector-bugs, webkit-bug-importer, yurys
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Test Case none

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>