0

The performance.timing stores the timing of the various events' that happen during the webpage loading:

Navigation timing overview
(source: dvcs.w3.org)

And I learned that HTML tags get parsed and <script> elements with neither 'defer' nor 'async' attribute get executed synchronously between domLoading and domInteractive, and then scripts with 'defer' attribute(i.e., scripts in list of scripts that will execute when the document has finished parsing) get executed before DOMContentLoaded. And then execute <script> element with async attribute, if there is any, before document.readyState is set to complete and load event fired on the Window object.

Spin the event loop until the set of scripts that will execute as soon as possible and the list of scripts that will execute in order as soon as possible are empty.

My question is when the webpage contents get displayed? Are they displayed at the same time when HTML tags are parsed? or in the scripts execute phase? or after loadEventEnd?
When load a large page, the loading icon still spins for a while after the page get displayed, Is the browser executing scripts during this time?

4

2 に答える 2

0

HTML ページは段階的に表示されます。一般に、表示はdomInteractive発生した時点 (通常、この時点ではまだすべてのコンテンツがまだ存在していない時点) から開始され、その後も継続します。

于 2013-02-28T17:02:55.473 に答える
0

IE9 以降で使用できるプロパティが 1 つあります。これは、Microsoft 専用の接頭辞付きの NavigationTiming 属性で、window.performance.timing.msFirstPaint. この属性は、ページが初めて描画されるときに公開されます。

他のブラウザーでは (まだ) 利用できません。また、他のブラウザーからの注目もあまり見られないため、NavigationTiming 標準の一部になるかどうかはわかりません。

于 2014-01-15T00:43:46.550 に答える