numerus/web/static
jordi fita mas f945051f4a Remove document and window event handlers when removing custom elements
I realized that the event handlers that i was setting when creating the
tags input and the multi-select controls were not removed just because
these elements are no longer in the document, and kept firing again and
again.

I no longer can use an anonymous function, because removeEventListener
would not match it with the one passed to addEventListener.  I also have
to bind the handler to `this` in order to keep having access to the
object, and, again, can not do it in the call to addEventListener, or
i would get a different function each time.

I added the check to see if the element is connected inside the
connectedCallback because the documentation warns that this callback
“may be called once your element is no longer connected”[0], and i
understood it to mean that the connected and disconnected callbacks
could be called our of order, thus it would be possible to add event
listeners that would not be removed—again.

I am not actually sure where i have to do the same for the rest of the
“internal” events.

[0]: https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks
2023-04-10 00:05:29 +02:00
..
fonts Remove unused Remixicon files 2023-01-31 13:17:51 +01:00
alpinejs@3.12.0.min.js Start “improving” the user interface with AlpineJS: tax selector 2023-03-14 18:07:38 +01:00
htmx@1.8.6.min.js Show the profile form in a dialog using HTMx 2023-03-20 13:09:52 +01:00
invoice.css Add the payment method to invoices 2023-03-05 18:50:57 +01:00
numerus.css Trigger filter form on change and search, as well as submit as before 2023-04-03 12:45:15 +02:00
numerus.js Remove document and window event handlers when removing custom elements 2023-04-10 00:05:29 +02:00
numerus.svg Clean up SVG icon 2023-01-30 16:33:49 +01:00