mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 13:23:34 -07:00
WebUI: remove child elements directly
This commit is contained in:
parent
e1bd1038c0
commit
72e033db79
2 changed files with 4 additions and 9 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue