20 ms·
If you are going to use this, you should use querySelectorAll('[data-2x]') to select the nodes, rather than getElementsByTagName('*') and then check if each nod
by mds101 13y ago
If you are going to use this, you should use querySelectorAll('[data-2x]') to select the nodes, rather than getElementsByTagName('*') and then check if each node has a data-2x as is done in the article, for performance reasons[1] and to make your code simpler.
[1] http://jsperf.com/queryselectorall-vs-getelementsbytagname/65 http://jsperf.com/queryselectorall-vs-getelementsbytagname/6...