document.querySelector('#element')['something'] = 'whatever'
What am I achieving by setting some sort of invisible attribute on the element? Is there any documentation on this?
I played around with it, confirmed that I can retrieve the value later and now I'm wondering is how useful it is and how reliable it is.
Yes, it can be done. But it's not advised. Remember that html and dom have many standards to adhere to and with changes such as these, you are testing the limits of user's browsers expectations.
This is more clearly explained in the answer to this question: Javascript DOM: Setting custom DOM element properties