summaryrefslogtreecommitdiffstats
path: root/browser/components/preferences/findInPage.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /browser/components/preferences/findInPage.js
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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);
}