I prefer using attributes like lang, dir, id, class and others to store useful data for some javascript functions that reference these objects - I do this to avoid using an array that may have to be updated after every action or change. The problem is that this is a bad practice and I cannot always use the attributes I want, because they're already in use or not available on some tag types. Is there a better way?
Note that I dont like using multiple values split with a separator as this is slow when dealing with massive amounts of objects.