From b148d1944f73cae3b9e7e120b7662a8882932013 Mon Sep 17 00:00:00 2001 From: Deleted user Date: Thu, 14 Nov 2024 08:54:24 -0300 Subject: [PATCH] WebUI: Remove elements directly --- src/webui/www/private/scripts/contextmenu.js | 2 +- src/webui/www/private/scripts/dynamicTable.js | 4 ++-- src/webui/www/private/scripts/mocha-init.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/webui/www/private/scripts/contextmenu.js b/src/webui/www/private/scripts/contextmenu.js index 758783411..b63c9c819 100644 --- a/src/webui/www/private/scripts/contextmenu.js +++ b/src/webui/www/private/scripts/contextmenu.js @@ -534,7 +534,7 @@ window.qBittorrent.ContextMenu ??= (() => { updateTagsSubMenu(tagList) { const contextTagList = $("contextTagList"); while (contextTagList.firstChild !== null) - contextTagList.removeChild(contextTagList.firstChild); + contextTagList.firstChild.remove(); const createMenuItem = (text, imgURL, clickFn) => { const anchor = document.createElement("a"); diff --git a/src/webui/www/private/scripts/dynamicTable.js b/src/webui/www/private/scripts/dynamicTable.js index 4a3b2c7e6..4fa836397 100644 --- a/src/webui/www/private/scripts/dynamicTable.js +++ b/src/webui/www/private/scripts/dynamicTable.js @@ -219,7 +219,7 @@ window.qBittorrent.DynamicTable ??= (() => { this.loadColumnsOrder(); this.updateTableHeaders(); while (this.tableBody.firstChild) - this.tableBody.removeChild(this.tableBody.firstChild); + this.tableBody.firstChild.remove(); this.updateTable(true); } if (this.currentHeaderAction === "drag") { @@ -398,7 +398,7 @@ window.qBittorrent.DynamicTable ??= (() => { // recreate child nodes when reusing (enables the context menu to work correctly) if (ul.hasChildNodes()) { while (ul.firstChild) - ul.removeChild(ul.lastChild); + ul.lastChild.remove(); } for (let i = 0; i < this.columns.length; ++i) { diff --git a/src/webui/www/private/scripts/mocha-init.js b/src/webui/www/private/scripts/mocha-init.js index dd1ff862d..d79864155 100644 --- a/src/webui/www/private/scripts/mocha-init.js +++ b/src/webui/www/private/scripts/mocha-init.js @@ -1124,7 +1124,7 @@ const initializeWindows = () => { element.download = (name + ".torrent"); document.body.appendChild(element); element.click(); - document.body.removeChild(element); + element.remove(); // https://stackoverflow.com/questions/53560991/automatic-file-downloads-limited-to-10-files-on-chrome-browser await window.qBittorrent.Misc.sleep(200);