summaryrefslogtreecommitdiffstats
path: root/browser/components/preferences/findInPage.js
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/preferences/findInPage.js')
-rw-r--r--browser/components/preferences/findInPage.js43
1 files changed, 25 insertions, 18 deletions
diff --git a/browser/components/preferences/findInPage.js b/browser/components/preferences/findInPage.js
index 9fcd7b629b..7ee0a0bc06 100644
--- a/browser/components/preferences/findInPage.js
+++ b/browser/components/preferences/findInPage.js
@@ -117,9 +117,9 @@ var gSearchResultsPane = {
},
/**
- * Finds and returns text nodes within node and all descendants
- * Iterates through all the sibilings of the node object and adds the sibilings
- * to an array if sibiling is a TEXT_NODE else checks the text nodes with in current node
+ * Finds and returns text nodes within node and all descendants.
+ * Iterates through all the siblings of the node object and adds each sibling to an
+ * array if it's a TEXT_NODE, and otherwise recurses to check text nodes within it.
* Source - http://stackoverflow.com/questions/10730309/find-all-text-nodes-in-html-page
*
* @param Node nodeObject
@@ -414,14 +414,20 @@ var gSearchResultsPane = {
let matchesFound = false;
if (
nodeObject.childElementCount == 0 ||
- nodeObject.tagName == "button" ||
- nodeObject.tagName == "label" ||
- nodeObject.tagName == "description" ||
- nodeObject.tagName == "menulist" ||
- nodeObject.tagName == "menuitem" ||
- nodeObject.tagName == "checkbox"
+ nodeObject.localName == "button" ||
+ nodeObject.localName == "label" ||
+ nodeObject.localName == "description" ||
+ nodeObject.localName == "menulist" ||
+ nodeObject.localName == "menuitem" ||
+ nodeObject.localName == "checkbox" ||
+ nodeObject.localName == "moz-toggle"
) {
let simpleTextNodes = this.textNodeDescendants(nodeObject);
+ if (nodeObject.shadowRoot) {
+ simpleTextNodes.push(
+ ...this.textNodeDescendants(nodeObject.shadowRoot)
+ );
+ }
for (let node of simpleTextNodes) {
let result = this.highlightMatches(
[node],
@@ -440,8 +446,8 @@ var gSearchResultsPane = {
let accessKeyTextNodes = [];
if (
- nodeObject.tagName == "label" ||
- nodeObject.tagName == "description"
+ nodeObject.localName == "label" ||
+ nodeObject.localName == "description"
) {
accessKeyTextNodes.push(...simpleTextNodes);
}
@@ -469,7 +475,7 @@ var gSearchResultsPane = {
// Searching some elements, such as xul:label, store their user-visible text in a "value" attribute.
// Value will be skipped for menuitem since value in menuitem could represent index number to distinct each item.
let valueResult =
- nodeObject.tagName !== "menuitem" && nodeObject.tagName !== "radio"
+ nodeObject.localName !== "menuitem" && nodeObject.localName !== "radio"
? this.queryMatchesContent(
nodeObject.getAttribute("value"),
searchPhrase
@@ -497,12 +503,13 @@ var gSearchResultsPane = {
// Creating tooltips for buttons
if (
keywordsResult &&
- (nodeObject.tagName === "button" || nodeObject.tagName == "menulist")
+ (nodeObject.localName === "button" ||
+ nodeObject.localName == "menulist")
) {
this.listSearchTooltips.add(nodeObject);
}
- if (keywordsResult && nodeObject.tagName === "menuitem") {
+ if (keywordsResult && nodeObject.localName === "menuitem") {
nodeObject.setAttribute("indicator", "true");
this.listSearchMenuitemIndicators.add(nodeObject);
let menulist = nodeObject.closest("menulist");
@@ -512,8 +519,8 @@ var gSearchResultsPane = {
}
if (
- (nodeObject.tagName == "menulist" ||
- nodeObject.tagName == "menuitem") &&
+ (nodeObject.localName == "menulist" ||
+ nodeObject.localName == "menuitem") &&
(labelResult || valueResult || keywordsResult)
) {
nodeObject.setAttribute("highlightable", "true");
@@ -529,7 +536,7 @@ var gSearchResultsPane = {
// Should not search unselected child nodes of a <xul:deck> element
// except the "historyPane" <xul:deck> element.
- if (nodeObject.tagName == "deck" && nodeObject.id != "historyPane") {
+ if (nodeObject.localName == "deck" && nodeObject.id != "historyPane") {
let index = nodeObject.selectedIndex;
if (index != -1) {
let result = await this.searchChildNodeIfVisible(
@@ -572,7 +579,7 @@ var gSearchResultsPane = {
) {
result = await this.searchWithinNode(child, searchPhrase);
// Creating tooltips for menulist element
- if (result && nodeObject.tagName === "menulist") {
+ if (result && nodeObject.localName === "menulist") {
this.listSearchTooltips.add(nodeObject);
}