Closed Bug 1229773 Opened 9 years ago Closed 8 years ago

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

Categories

(DevTools :: Inspector, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: pbro, Unassigned)

References

(Depends on 1 open bug)

Details

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

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
- go to data:text/html,<div></div> and enter body * suggestion popup only contains "body", but selecting this suggestion replaces the field with "div"
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
(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
С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
Whiteboard: All cases of this bug are most likely regressions from 835896
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
Closed: 8 years ago
Resolution: --- → FIXED
Depends on: 1327037
Depends on: 1327141
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.