The css selector search part of the inspector search tool is really buggy

RESOLVED FIXED

Status

()

Firefox
Developer Tools: Inspector
RESOLVED FIXED
2 years ago
a year ago

People

(Reporter: pbro, Unassigned)

Tracking

(Depends on: 1 bug, {meta})

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: All cases of this bug are most likely regressions from 835896)

(Reporter)

Description

2 years ago
The inspector search tool can be used to do 2 things: search for text in the page, and search for elements that match a given selector.
The latter is quite buggy. For simple cases it works well, but when selectors become complex, it doesn't always work well.
A few problems I see with the code:

- _showPopup in inspector-search.js uses regexp all over the places, this isn't a bug in itself but is error-prone and makes the code harder to read
- this code doesn't handle attribute selectors at all div[a], div[a*=b], ... (this is partly fixed with bug 1225514)
- part of this code assumes id/class attributes have only letters, while they can contain numbers, underscores and hyphens, and can even start with underscores or hyphens
- getSuggestionsForQuery in inspector.js (on the server) does not seem to handle attribute selectors at all either

Here are use cases that fail currently:

- go to data:text/html,<a class="test" id="id1">
  and enter #id1.tes
  suggestion popup is broken and pressing enter replaces the value with just .test

- go to data:text/html,<a class="class1" id="id1">
  and enter .class1#id
  same

There might be other
(Reporter)

Comment 1

2 years ago
- go to data:text/html,<div></div>
  and enter body *
  suggestion popup only contains "body", but selecting this suggestion replaces the field with "div"

Comment 2

2 years ago
Is this a meta-bug? Does it "covers" all such cases as subsets or those reports should be marked as blocking to this one? Also, you haven't mention the issue with adding  :not(...) pseudoclass. That is the simpliest workaround I found to actually search_with_СSS_selectors, and it's affected by this bug
(Reporter)

Comment 3

2 years ago
(In reply to arni2033 from comment #2)
> Is this a meta-bug? Does it "covers" all such cases as subsets or those
> reports should be marked as blocking to this one? Also, you haven't mention
> the issue with adding  :not(...) pseudoclass. That is the simpliest
> workaround I found to actually search_with_СSS_selectors, and it's affected
> by this bug
I filed this a while ago after working a little bit on the search tool, but never really add time to do anything about it. You're right, this should be a meta bug. Feel free to link all the bugs you've filed or seen related to this lately. Thanks.
Keywords: meta

Comment 4

2 years ago
Сurrently it's unclear whether this is a general defect or each group of selectors is broken in its unique way (what groups exactly?). So I believe it's pointless to have >1 open bugs blocking this.
Also, this bug should be marked as "regression" or at least connected to bug 835896 which broke it.
(I also think it's good idea to check each bug from this type if it indeed was caused by 835896)
Cancel my changes if you disagree.
Blocks: 835896
Depends on: 1245365

Updated

2 years ago
Whiteboard: All cases of this bug are most likely regressions from 835896

Comment 5

2 years ago
Search doesn't work at all for HTML entities (e.g. &nbsp;)

https://bugzilla.mozilla.org/show_bug.cgi?id=1256756
-> https://bugzilla.mozilla.org/show_bug.cgi?id=967493
(Reporter)

Comment 6

2 years ago
Old meta bug with 2 dependencies that have been fixed. Let's close this one now, and file other separate issues when needed.
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED

Updated

a year ago
Depends on: 1327037

Updated

a year ago
Depends on: 1327141
You need to log in before you can comment on or make changes to this bug.