DOM nodes keeps increasing
vfxturjo opened this issue · 3 comments
hi. i am trying to understand why DOM nodes count is increasing constantly
i found this div to be reacting automatically in the background...
if i remove this event listener, i get this: the div gets filled with lots of texts... mainly this is midi device ports...
i am thinking why did this happen??
i searched for possible reasons for this dom to be created and found this. (it might help demystify..?)
if i let it run, the count goes crazy high like this...
😭
i dont understand why this is happening and how to fix... please help
my code may be the problem, but i want to know why it happened and how to avoid this problem...
hi. update:
I found that commenting out this line solves the problem.
when i click on refresh button which does JZZ().refresh()
method, the <div id="jazz-midi-msg">...</div>
updates. also, DOM node count increases by 3.
if i remove the event listener...
then on each run of JZZ().refresh()
method, one line is added: (i clicked 5 times)
so, i think JZZ().refresh() method is keeping history of all times when refresh() method is called. maybe to compare the current value with previous one to see if there is any difference? (just my thought), but it uses memory and DOM.
is this intentional? or is this a bug?
This DIV is used to communicate with the Jazz-MIDI browser extension.
The event listener reads it and then cleans it up.
I don't understand what you are trying to accomplish by removing the event listener.
I see... I removed the event listener just to try to understand what it does.
Mainly my problem is with DOM nodes count. I mean, even if i didn't remove the event listener, the count was increasing gradually.
Mainly if i use JZZ().refresh() method.
(+3 DOM nodes per call)
Or if i subscribe to onChange() method...
(+3 or +6 DOM nodes per second)
I was trying to understand if this is normal or not... that constant increase of DOM nodes count