I have a custom JavaScript object and I want it to be "linked" with an element from the DOM.
var my_object = {}
var element = document.getElementsByClassName("a_class")[7];
my_object["element"] = element;
As I will need many of these objects, I wondered if directly storing DOM object obtained from .getElement() was a good idea?
I am scared that this will construct heavy objects. Is it the case, or does Javascript use some kind of clever and light references?
Alternatively, I thought to add a custom id to the element before stroring this id but this is less convenient.