Closed Bug 1980892 Opened 7 months ago Closed 7 months ago

Inspector search can't find css selector with hyphen

Categories

(DevTools :: Inspector, defect)

defect

Tracking

(firefox-esr128 unaffected, firefox-esr140 fixed, firefox141 wontfix, firefox142 fixed, firefox143 fixed)

RESOLVED FIXED
143 Branch
Tracking Status
firefox-esr128 --- unaffected
firefox-esr140 --- fixed
firefox141 --- wontfix
firefox142 --- fixed
firefox143 --- fixed

People

(Reporter: jdescottes, Assigned: nchevobbe)

References

(Blocks 1 open bug, Regression, )

Details

(Keywords: regression)

Attachments

(3 files)

STRs:

  • open data:text/html,<div class="a b-c">
  • open inspector
  • try to search div.a -> OK, .b-c -> OK, div.b-c -> KO

Note that the popup suggests div.b-c in the autocomplete.

Keywords: regression
Regressed by: 1871881

That's because of https://searchfox.org/mozilla-central/rev/81221d27112f12a67cb86287bf2b3cd9f19373af/devtools/server/actors/utils/walker-search.js#265,270-272,275-282

_searchSelectors(query, options, results) {
...
  // If the query is just one "word", no need to search because _searchIndex
  // will lead the same results since it has access to tagnames anyway
  if (
...
    // custom element names
    InspectorUtils.isCustomElementName(
      query,
      this.walker.targetActor.window.document.documentElement.namespaceURI
    )
  ) {
    return;
  }

InspectorUtils.isCustomElementName("div.b-c") returns true (so does InspectorUtils.isCustomElementName("div#b-c"))

We used to check if the passed query looked like a tag name so we could
bail out early, as we'd get those results from _searchIndex.
But InspectorUtils.isCustomElementName does match some legitimate
selectors, like div.a-b.
Let's remove the check on custom element and trigger the search in such case.

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED

Set release status flags based on info from the regressing bug 1871881

Pushed by nchevobbe@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/984841a1f95e https://hg.mozilla.org/integration/autoland/rev/a32bf35caeca [devtools] Remove use of InspectorUtils.isCustomElementName on WalkerSearch#_searchSelectors. r=devtools-reviewers,jdescottes.
Flags: in-testsuite+
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 143 Branch

We used to check if the passed query looked like a tag name so we could
bail out early, as we'd get those results from _searchIndex.
But InspectorUtils.isCustomElementName does match some legitimate
selectors, like div.a-b.
Let's remove the check on custom element and trigger the search in such case.

Original Revision: https://phabricator.services.mozilla.com/D259783

Attachment #9505102 - Flags: approval-mozilla-beta?

firefox-beta Uplift Approval Request

  • User impact if declined: Searching for an element in the inspector using a selector might not work
  • Code covered by automated testing: yes
  • Fix verified in Nightly: no
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing: -
  • Risk associated with taking this patch: low
  • Explanation of risk level: devtools only patch, removing a simple guard, covered by mochitest
  • String changes made/needed: -
  • Is Android affected?: no
Attachment #9505102 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

We used to check if the passed query looked like a tag name so we could
bail out early, as we'd get those results from _searchIndex.
But InspectorUtils.isCustomElementName does match some legitimate
selectors, like div.a-b.
Let's remove the check on custom element and trigger the search in such case.

Original Revision: https://phabricator.services.mozilla.com/D259783

Attachment #9505638 - Flags: approval-mozilla-esr140?

firefox-esr140 Uplift Approval Request

  • User impact if declined: Searching for an element in the inspector using a selector might not work
  • Code covered by automated testing: yes
  • Fix verified in Nightly: no
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing: -
  • Risk associated with taking this patch: low
  • Explanation of risk level: devtools only patch, removing a simple guard, covered by mochitest
  • String changes made/needed: -
  • Is Android affected?: no
Attachment #9505638 - Flags: approval-mozilla-esr140? → approval-mozilla-esr140+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: