getElementsByTagName is much faster than querySelectorAll

2019-11-24

According to the section What is a Pattern? of the book Learning JavaScript Design Patterns by Addi Osmani: https://addyosmani.com/resources/essentialjsdesignpatterns/book/#whatisapattern

So, if selecting by class, this

const listItems = list.getElementsByTagName('list-item');

would be preferable to

const listItems = list.querySelectorAll('.list-item');