Storing data?
I was reading an article where the author says it is not a good practice to store data in the DOM. Indeed this is a bad practice and you should avoid it. After that he gives an example with using the DOM with the ALT attribute:
$('selector').attr('alt', 'data being stored'); // later the data can be retrieved using: $('selector').attr('alt');
and after that the more clean:
$('selector').data('paramtername', 'data being stored'); // then later getting the data with $('selector').data('paramtername');
OK, is more clean. But however it is bad practice to use such a “heavy” construction to store local data. It is obvious you can prefer to store it in a local variable. Thus you avoid the extra performance.