WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
138438
Web Inspector: Pseudo element matchedCSSRules do not include matching selector info
https://bugs.webkit.org/show_bug.cgi?id=138438
Summary
Web Inspector: Pseudo element matchedCSSRules do not include matching selecto...
Joseph Pecoraro
Reported
2014-11-05 14:07:07 PST
* SUMMARY Pseudo element matchedCSSRules do not include matching selector info. The frontend then displays all selectors as matching instead of showing exactly which selector matched. * STEPS TO REPRODUCE 1. Inspect <audio> on data:text/html,<audio%20controls> 2. Expand Shadow DOM and select ::webkit-media-text-track-container element 3. Show Styles Sidebar => "video::-webkit-media-text-track-container, audio::-webkit-media-text-track-container" selectors are both highlighted. => expected only audio::-webkit-media-text-track-container to be highlighted, since this is an <audio> * NOTES The result of CSSAgent.getMatchedStylesForNode includes the Rule and Selectors, but an empty matchingSelectors list. { "result": { "matchedCSSRules": [ ... { "rule": { "selectorList": { "selectors": [{ "text": "video::-webkit-media-controls-panel", "specificity": [0, 1, 1] }, { "text": "audio::-webkit-media-controls-panel", "specificity": [0, 1, 1] }], "text": "video::-webkit-media-controls-panel, audio::-webkit-media-controls-panel" }, }, "matchingSelectors": [] }] ... } }
Attachments
[PATCH] Proposed Fix
(12.09 KB, patch)
2014-11-05 15:58 PST
,
Joseph Pecoraro
benjamin
: review+
benjamin
: commit-queue-
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2014-11-05 14:07:33 PST
<
rdar://problem/18885821
>
Joseph Pecoraro
Comment 2
2014-11-05 15:06:06 PST
Ben helped point out the issue. InspectorCSSAgent::buildArrayForMatchedRuleList was using the JavaScript Element::matches API which won't work with pseudo elements. He suggested instead that we use the SelectorChecker machinery. That works great!
Joseph Pecoraro
Comment 3
2014-11-05 15:58:59 PST
Created
attachment 241070
[details]
[PATCH] Proposed Fix The test here is pretty crappy. I'll see if I can come up with a better test.
Benjamin Poulain
Comment 4
2014-11-06 14:29:28 PST
Comment on
attachment 241070
[details]
[PATCH] Proposed Fix View in context:
https://bugs.webkit.org/attachment.cgi?id=241070&action=review
> LayoutTests/ChangeLog:9 > + * inspector/css/psuedo-element-matches-expected.txt: Added. > + * inspector/css/psuedo-element-matches.html: Added.
Typo: pseudo. There are other interesting problem with the old code: -Regular pseudo element matching, a::before, b::after, etc can never match. -:visited can never match.
Joseph Pecoraro
Comment 5
2014-11-07 12:31:09 PST
<
http://trac.webkit.org/changeset/175758
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug