📜 ⬆️ ⬇️

Accelerate CSS Selectors: id vs. class, second round

In the first article of the cycle, I already considered the speed of the engine responsible for creating and displaying an HTML page on the screen. However, now we will talk about a slightly different aspect than the CSS selector engine. This series of tests was devoted to the speed of creating a separate HTML document.

Technique



If in the first two studies, the browser’s recognition rate for CSS rules and their application was questioned, now another question was interesting, namely, how quickly does the browser create a DOM tree depending on the presence of elements with id or class ?
')
For this, 3 sets of HTML files were prepared. The first contained 10,000 elements in which a part has an id (the number of named elements ranged from 50 to 10,000). In the second, the HTML files were practically identical, only instead of id they had an attribute class . In the third set in the DOM tree there were only elements with id (i.e. the number of elements varied). Accordingly, all measurements were carried out in a hidden iframe to avoid drawing the loaded page on the screen.

read further on webo.in →

Source: https://habr.com/ru/post/25388/


All Articles