commit a72f325782cefd7ce0c7fdb4303f8f37a0db90cb
parent 12b4adb7efa5bbcd4eff9522044c2fef91d84af8
Author: Beth Rennie <beth@brennie.ca>
Date: Fri, 14 Nov 2025 21:04:27 +0000
Bug 2000255 - Search nodes that contain anchor tags in preferences r=akulyk
Differential Revision: https://phabricator.services.mozilla.com/D272672
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/browser/components/preferences/findInPage.js b/browser/components/preferences/findInPage.js
@@ -408,6 +408,16 @@ var gSearchResultsPane = {
},
/**
+ * Determine if the given element is an anchor tag.
+ *
+ * @param {HTMLElement} el The element.
+ * @returns {boolean} Whether or not the element is an anchor tag.
+ */
+ _isAnchor(el) {
+ return (el.prefix === null || el.prefix === "html") && el.localName === "a";
+ },
+
+ /**
* Finding leaf nodes and checking their content for words to search,
* It is a recursive function
*
@@ -421,6 +431,8 @@ var gSearchResultsPane = {
let matchesFound = false;
if (
nodeObject.childElementCount == 0 ||
+ (typeof nodeObject.children !== "undefined" &&
+ Array.prototype.every.call(nodeObject.children, this._isAnchor)) ||
this.searchableNodes.has(nodeObject.localName) ||
(nodeObject.localName?.startsWith("moz-") &&
nodeObject.localName !== "moz-input-box")