Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory Leak #7

Open
MathieuB1 opened this issue Jan 12, 2025 · 0 comments
Open

Memory Leak #7

MathieuB1 opened this issue Jan 12, 2025 · 0 comments

Comments

@MathieuB1
Copy link

MathieuB1 commented Jan 12, 2025

Steps for Reproduction

  1. Create a page where quilljs and quill-resize-image are instanciated
  2. Navigate to another page
  3. Back to initial page

Expected behavior:

No Memory leak

Actual behavior:

Memory leak due to eventListeners not removed

        container.addEventListener("click", function(e) {
          var target = e.target;
          if (e.target && ["img", "video"].includes(target.tagName.toLowerCase())) {
            resizeTarge = target;
            resizePlugin = new ResizePlugin(target, container.parentElement, container, __assign(__assign({}, options), { onChange: triggerTextChange }));
          }
        });
...
        document.addEventListener("mousedown", function(e) {
          var _a, _b, _c;
          var target = e.target;
          if (target !== resizeTarge && !((_b = (_a = resizePlugin === null || resizePlugin === void 0 ? void 0 : resizePlugin.resizer) === null || _a === void 0 ? void 0 : _a.contains) === null || _b === void 0 ? void 0 : _b.call(_a, target))) {
            (_c = resizePlugin === null || resizePlugin === void 0 ? void 0 : resizePlugin.destory) === null || _c === void 0 ? void 0 : _c.call(resizePlugin);
            resizePlugin = null;
            resizeTarge = null;
          }
        }, { capture: true });
      }

eventListeners is not properly removed using removeEventListener method when destroying

Platforms:

Chrome v131.0.6778.205 (Build officiel) (64 bits)

Version:

"quill": "2.0.3"
"quill-resize-image": "1.0.5"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant