RobinHerbots / Inputmask

Input Mask plugin
https://robinherbots.github.io/Inputmask/
MIT License
6.36k stars 2.18k forks source link

Form Reset/Submit DOM Memory Leak #2783

Closed melloware closed 3 weeks ago

melloware commented 3 months ago

Similar to this old issue: https://github.com/RobinHerbots/Inputmask/issues/1466

I am using jQuery InputMask and if I call jq.inputmask("remove"); I can see detached HTMLInputElement in memory and its because of the InputMask reset and submit events.

image

If I call jq..inputmask('remove').inputmask(maskCfg); 3 times I now see this..

image

You can see its got 3 references so the garbage collector can never clean up the Detached DOM Element.

RobinHerbots commented 3 weeks ago

Hi @melloware ,

I tried to reproduce what you see, but failing (I must be missing something small). Can you provide a minimal example in a fiddle. I only see image

Anyway I already have a guess where to release those form events, but I want to be sure.

melloware commented 3 weeks ago

i may have to reproduce it with my exact code but I can provide a reproducer although it may be in Maven-Java let me try and reproduce.

melloware commented 3 weeks ago

OK now I am having trouble reproducing it. Let me close this until I can reproduce it.

RobinHerbots commented 3 weeks ago

if (["submit", "reset"].includes(eventName)) { if (input.form !== null) $(input.form).off(eventName, ev); } else {

normally this should deal with it, and is already present in de codebase