Current time: 05-19-2019, 06:23 PM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About DomContentLoadedEvent
05-06-2019, 04:07 PM
Post: #1
Wink About DomContentLoadedEvent
Hi everyone,
I am a newbie for web performance. I am trying to figure out the relationship between the timestamp when DomContentLoadedEvent is fired and the timestamp when browser start to paint content.

does DomContentLoadedEvent indicate browser start to render soon? or can browser start to paint before DomContentLoadedEvent is fired?

Thank you!
Find all posts by this user
Quote this message in a reply
05-06-2019, 10:21 PM
Post: #2
RE: About DomContentLoadedEvent
They are completely unrelated and will depend on the page you are looking at. DOMContentLoaded means the browser's parser made it to the end of the HTML (and executed any blocking scripts). Any given page can render well before or well after that point depending on how it is constructed.
Visit this user's website Find all posts by this user
Quote this message in a reply
05-08-2019, 04:16 AM
Post: #3
RE: About DomContentLoadedEvent
Thank you so much Patrick,
do you have any example in mind that a website can render well before DOMContentLoaded (before the HTML is even parsed)?
Find all posts by this user
Quote this message in a reply
05-08-2019, 06:24 AM
Post: #4
RE: About DomContentLoadedEvent
Sure, here: https://www.webpagetest.org/result/19050...view_step1

DOMContentLoaded at 4.1s, start render at 2.2s.

The browser parses the HTML incrementally as it goes through the document and it can render what it has any time after it gets into the <body>. It's not unusual to render before DCL for pages that have blocking scripts towards the end of the document. DCL just means it has completed parsing ALL of the HTML but it has enough to render content a lot earlier.

Often it will choose NOT to render earlier so it doesn't have to do layout/paint multiple times so it tries to be greedy and keep parsing HTML as quickly as it can but if it gets delayed for too long and has something it can potentially render, it will.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)