mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 14:08:03 -06:00
WebUI: prevent passing wrong parameter
The `event` object will be passed as the first parameter to the event handler. So wrap the event handler with a closure to prevent `event` leaking to other functions.
This commit is contained in:
@@ -440,7 +440,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
const createMenuItem = (text, imgURL, clickFn) => {
|
||||
const anchor = document.createElement("a");
|
||||
anchor.textContent = text;
|
||||
anchor.addEventListener("click", clickFn);
|
||||
anchor.addEventListener("click", () => { clickFn(); });
|
||||
|
||||
const img = document.createElement("img");
|
||||
img.src = imgURL;
|
||||
@@ -495,7 +495,7 @@ window.qBittorrent.ContextMenu ??= (() => {
|
||||
const createMenuItem = (text, imgURL, clickFn) => {
|
||||
const anchor = document.createElement("a");
|
||||
anchor.textContent = text;
|
||||
anchor.addEventListener("click", clickFn);
|
||||
anchor.addEventListener("click", () => { clickFn(); });
|
||||
|
||||
const img = document.createElement("img");
|
||||
img.src = imgURL;
|
||||
|
||||
Reference in New Issue
Block a user