Skip to content

Commit

Permalink
WebUI: Don't keep references to context menu targets
Browse files Browse the repository at this point in the history
  • Loading branch information
skomerko authored Feb 11, 2025
1 parent 069cd02 commit 730bf95
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/webui/www/private/scripts/contextmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ window.qBittorrent.ContextMenu = (function() {

// option diffs menu
this.menu = $(this.options.menu);
this.targets = $$(this.options.targets);

// fx
this.fx = new Fx.Tween(this.menu, {
Expand Down Expand Up @@ -185,11 +184,14 @@ window.qBittorrent.ContextMenu = (function() {
},

addTarget: function(t) {
if (t.hasEventListeners)
return;

// prevent long press from selecting this text
t.style.setProperty("user-select", "none");
t.style.setProperty("-webkit-user-select", "none");
t.hasEventListeners = true;

this.targets[this.targets.length] = t;
this.setupEventListeners(t);
},

Expand All @@ -210,8 +212,8 @@ window.qBittorrent.ContextMenu = (function() {
// get things started
startListener: function() {
/* all elements */
this.targets.each((el) => {
this.setupEventListeners(el);
$$(this.options.targets).each((el) => {
this.addTarget(el);
}, this);

/* menu items */
Expand Down

0 comments on commit 730bf95

Please sign in to comment.