2024-08-17 00:02:59

JavaScript question/help…

Context: I’m building a bunch of DOM elements from an array of configuration objects.

The objects might have callbacks that need to be called on events on the created DOM elements.

Question: Is it OK to just add the callbacks as “custom properties” on the DOM elements when creating them? Is that bad for some reason? Is there a better way?

Thanks in advance.

P.S. This is vanilla JS. No framework!!