HTML optimizations
As web developers, we are well versed in creating templates. In this section, we will explore ways in which we can make this process as efficient as possible.Â
DOM structuring
As obvious as this might seem, DOM structuring can make quite a big difference when it comes to rendering the UI. For an HTML template to become DOM, it goes through a series of steps:
- Template Parsing : Parser reads the HTML file
- Tokenization: Parser identifies the tokens, such as
html
 andÂbody
- Lexing: Parser converts the tokens to tags, such as
<html>
 andÂ<body>
- DOM Construction: This is the last step where the browser converts the tags into a tree while applying the applicable styles and rules for the element
With that in mind, it becomes important that we do not nest our elements unnecessarily. Try to apply styles to elements rather than nest them in other elements. With that being said, one might wonder, how much does this really matter? The browsers are pretty good at doing this, so would...