Closed Bug 1871881 Opened 2 years ago Closed 8 months ago

Make inspector "search HTML" feature able to use :has() and such selectors

Categories

(DevTools :: Inspector, defect, P3)

defect

Tracking

(firefox140 fixed)

RESOLVED FIXED
140 Branch
Tracking Status
firefox140 --- fixed

People

(Reporter: emilio, Assigned: nchevobbe)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

According to bug 418039 comment 88, it doesn't work, and some other combinators are suggested, but also don't work. Not sure if this is intended so filing as a defect for now.

See Also: → has-pseudo
Blocks: has-issues

So, the search seems to work in some cases for me, but only if I add a space after the closing paren.

Also, the suggestion popup acts super weirdly. For example, on data:text/html,<meta charset=utf8><body><main>hello, if I type :has(body, there's no suggestion shown at any point. But then, as soon as I enter the closing paren, the suggestion does appear, but:

  • it is visually truncated
  • if I hit enter, the input value is set to body ?!

I'll look into those issues

Severity: -- → S3
Priority: -- → P3
See Also: → 1542277

In walker.js, for the selector search, we want to avoid calling querySelectorAll if the search
query is a simple tagname, as those are already retrieved in _searchIndex.
The regex that was used to check if we had a complex selector was wrong and would fail to
detect selector with pseudo class (e.g. section:has(button)).
We fix this by checking if the query does look like a tagname (only includes a-z chars and -),
and we add another check to see if the query is a valid selector, using CSS.supports.

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED

(In reply to Nicolas Chevobbe [:nchevobbe] from comment #1)

So, the search seems to work in some cases for me, but only if I add a space after the closing paren.

Also, the suggestion popup acts super weirdly. For example, on data:text/html,<meta charset=utf8><body><main>hello, if I type :has(body, there's no suggestion shown at any point. But then, as soon as I enter the closing paren, the suggestion does appear, but:

  • it is visually truncated
  • if I hit enter, the input value is set to body ?!

I'll look into those issues

this looks like Bug 1542277 , I'll investigate there

Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/92ddaa0e20b2 [devtools] Fix Inspector selector search using functional pseudo classes. r=devtools-reviewers,jdescottes.
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 140 Branch
QA Whiteboard: [qa-triage-done-c141/b140]
Regressions: 1980892
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: