mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 14:38:04 -06:00
WebUI: remove child elements directly
This commit is contained in:
@@ -535,8 +535,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
|||||||
|
|
||||||
updateTagsSubMenu(tagList) {
|
updateTagsSubMenu(tagList) {
|
||||||
const contextTagList = $("contextTagList");
|
const contextTagList = $("contextTagList");
|
||||||
while (contextTagList.firstChild !== null)
|
contextTagList.replaceChildren();
|
||||||
contextTagList.removeChild(contextTagList.firstChild);
|
|
||||||
|
|
||||||
const createMenuItem = (text, imgURL, clickFn) => {
|
const createMenuItem = (text, imgURL, clickFn) => {
|
||||||
const anchor = document.createElement("a");
|
const anchor = document.createElement("a");
|
||||||
|
|||||||
@@ -288,8 +288,7 @@ window.qBittorrent.DynamicTable ??= (() => {
|
|||||||
LocalPreferences.set("columns_order_" + this.dynamicTableDivId, val.join(","));
|
LocalPreferences.set("columns_order_" + this.dynamicTableDivId, val.join(","));
|
||||||
this.loadColumnsOrder();
|
this.loadColumnsOrder();
|
||||||
this.updateTableHeaders();
|
this.updateTableHeaders();
|
||||||
while (this.tableBody.firstChild)
|
this.tableBody.replaceChildren();
|
||||||
this.tableBody.removeChild(this.tableBody.firstChild);
|
|
||||||
this.updateTable(true);
|
this.updateTable(true);
|
||||||
}
|
}
|
||||||
if (this.currentHeaderAction === "drag") {
|
if (this.currentHeaderAction === "drag") {
|
||||||
@@ -465,11 +464,8 @@ window.qBittorrent.DynamicTable ??= (() => {
|
|||||||
this.showColumn(action, this.columns[action].visible === "0");
|
this.showColumn(action, this.columns[action].visible === "0");
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
// recreate child nodes when reusing (enables the context menu to work correctly)
|
// recreate child elements when reusing (enables the context menu to work correctly)
|
||||||
if (ul.hasChildNodes()) {
|
ul.replaceChildren();
|
||||||
while (ul.firstChild)
|
|
||||||
ul.removeChild(ul.lastChild);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < this.columns.length; ++i) {
|
for (let i = 0; i < this.columns.length; ++i) {
|
||||||
const text = this.columns[i].caption;
|
const text = this.columns[i].caption;
|
||||||
|
|||||||
Reference in New Issue
Block a user