From 3ad1818311496784688dc28e60e5f342866f4fce Mon Sep 17 00:00:00 2001 From: def00111 Date: Sun, 5 Jul 2026 20:17:43 +0200 Subject: [PATCH] Update title nodes to prepend 'WebExtension ' replaceAll() method is not needed for this example. --- .../webextensions/api/webrequest/streamfilter/ondata/index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/files/en-us/mozilla/add-ons/webextensions/api/webrequest/streamfilter/ondata/index.md b/files/en-us/mozilla/add-ons/webextensions/api/webrequest/streamfilter/ondata/index.md index 16a6504ddc68b91..5658d549e3615ad 100644 --- a/files/en-us/mozilla/add-ons/webextensions/api/webrequest/streamfilter/ondata/index.md +++ b/files/en-us/mozilla/add-ons/webextensions/api/webrequest/streamfilter/ondata/index.md @@ -200,7 +200,9 @@ function listener(details) { const doc = parser.parseFromString(str, blob.type); const nodes = doc.querySelectorAll("title, h1"); for (const node of nodes) { - node.innerText = node.innerText.replaceAll("Example", "WebExtension $&"); + if (node.firstChild.substringData(0, 7) === "Example") { + node.firstChild.insertData(0, "WebExtension "); + } } filter.write(encoder.encode(doc.documentElement.outerHTML)); filter.close();