Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Data Structures and Algorithms with JavaScript

You're reading from   Hands-On Data Structures and Algorithms with JavaScript Write efficient code that is highly performant, scalable, and easily testable using JavaScript

Arrow left icon
Product type Paperback
Published in Jan 2018
Publisher Packt
ISBN-13 9781788398558
Length 332 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Kashyap Mukkamala Kashyap Mukkamala
Author Profile Icon Kashyap Mukkamala
Kashyap Mukkamala
Arrow right icon
View More author details
Toc

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:

  1. Template Parsing : Parser reads the HTML file
  2. Tokenization: Parser identifies the tokens, such as html and body
  3. Lexing: Parser converts the tokens to tags, such as <html> and <body>
  4. 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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at R$50/month. Cancel anytime