From 25dd6c72f78bfdfbb4c3bfa774523e43c54a3349 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Mon, 15 Jul 2024 17:06:48 +0800 Subject: [PATCH] WebUI: use the correct property for accessing text In these instances we don't need the rendered result. So use the most efficient property to access it: `.textContent`. --- src/webui/www/private/newtag.html | 2 +- src/webui/www/private/scripts/prop-trackers.js | 2 +- src/webui/www/private/views/rss.html | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/webui/www/private/newtag.html b/src/webui/www/private/newtag.html index a662fc108..b02937e22 100644 --- a/src/webui/www/private/newtag.html +++ b/src/webui/www/private/newtag.html @@ -34,7 +34,7 @@ const uriHashes = window.qBittorrent.Misc.safeTrim(new URI().getData("hashes")); if (uriAction === "create") - $("legendText").innerText = "QBT_TR(Tag:)QBT_TR[CONTEXT=TagFilterWidget]"; + $("legendText").textContent = "QBT_TR(Tag:)QBT_TR[CONTEXT=TagFilterWidget]"; $("tagName").focus(); diff --git a/src/webui/www/private/scripts/prop-trackers.js b/src/webui/www/private/scripts/prop-trackers.js index e9d04be49..f675075b0 100644 --- a/src/webui/www/private/scripts/prop-trackers.js +++ b/src/webui/www/private/scripts/prop-trackers.js @@ -187,7 +187,7 @@ window.qBittorrent.PropTrackers ??= (() => { if (current_hash.length === 0) return; - const trackerUrl = encodeURIComponent(element.childNodes[1].innerText); + const trackerUrl = encodeURIComponent(element.childNodes[1].textContent); new MochaUI.Window({ id: "trackersPage", title: "QBT_TR(Tracker editing)QBT_TR[CONTEXT=TrackerListWidget]", diff --git a/src/webui/www/private/views/rss.html b/src/webui/www/private/views/rss.html index ed522d15a..48c75a9a1 100644 --- a/src/webui/www/private/views/rss.html +++ b/src/webui/www/private/views/rss.html @@ -401,7 +401,7 @@ if (article) { $("rssDetailsView").append((() => { const torrentName = document.createElement("p"); - torrentName.innerText = article.title; + torrentName.textContent = article.title; torrentName.id = "rssTorrentDetailsName"; return torrentName; })()); @@ -410,11 +410,11 @@ torrentDate.id = "rssTorrentDetailsDate"; const torrentDateDesc = document.createElement("b"); - torrentDateDesc.innerText = "QBT_TR(Date: )QBT_TR[CONTEXT=RSSWidget]"; + torrentDateDesc.textContent = "QBT_TR(Date: )QBT_TR[CONTEXT=RSSWidget]"; torrentDate.append(torrentDateDesc); const torrentDateData = document.createElement("span"); - torrentDateData.innerText = new Date(article.date).toLocaleString(); + torrentDateData.textContent = new Date(article.date).toLocaleString(); torrentDate.append(torrentDateData); return torrentDate;