Fastest way to list children: childNodes vs children vs firstChild/nextSibling vs firstElementChild/nextElementSibling v2 fixed
Result: firstElementChild is the fastest yielding 3-4X performance. With lastElementChild close (margin of error) 2nd.
Other observations: doing for loop i-- with children shows ~150% higher performance vs i++. And unloading it into a variable prior yields another ~200% boost
one year ago
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/117.0.2045.31