author | Ricky Chien <ricky060709@gmail.com> |
Fri, 23 Jun 2017 13:37:57 +0800 | |
changeset 366099 | 743a610d7281ab7564634df0ecdf24c0a6043eb6 |
parent 366098 | 5c41d4abf2841e4dd3985d08025c59038d96fb2b |
child 366100 | 4961b6529b1a7e30daba766b3dc96614322fedfe |
push id | 32094 |
push user | cbook@mozilla.com |
push date | Tue, 27 Jun 2017 08:49:48 +0000 |
treeherder | mozilla-central@bda394665daa [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mconley |
bugs | 1374588 |
milestone | 56.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
browser/components/preferences/in-content-new/findInPage.js | file | annotate | diff | comparison | revisions |
--- a/browser/components/preferences/in-content-new/findInPage.js +++ b/browser/components/preferences/in-content-new/findInPage.js @@ -270,30 +270,37 @@ var gSearchResultsPane = { * @param Node nodeObject * DOM Element * @param String searchPhrase * @returns boolean * Returns true when found in at least one childNode, false otherwise */ searchWithinNode(nodeObject, searchPhrase) { let matchesFound = false; - if (nodeObject.childElementCount == 0 || nodeObject.tagName == "menulist") { + if (nodeObject.childElementCount == 0 || + nodeObject.tagName == "label" || + nodeObject.tagName == "description" || + nodeObject.tagName == "menulist") { let simpleTextNodes = this.textNodeDescendants(nodeObject); for (let node of simpleTextNodes) { let result = this.highlightMatches([node], [node.length], node.textContent.toLowerCase(), searchPhrase); matchesFound = matchesFound || result; } - // Collecting data from boxObject + // Collecting data from boxObject / label / description let nodeSizes = []; let allNodeText = ""; let runningSize = 0; let accessKeyTextNodes = this.textNodeDescendants(nodeObject.boxObject); + if (nodeObject.tagName == "label" || nodeObject.tagName == "description") { + accessKeyTextNodes.push(...this.textNodeDescendants(nodeObject)); + } + for (let node of accessKeyTextNodes) { runningSize += node.textContent.length; allNodeText += node.textContent; nodeSizes.push(runningSize); } // Access key are presented let complexTextNodesResult = this.highlightMatches(accessKeyTextNodes, nodeSizes, allNodeText.toLowerCase(), searchPhrase);