Using DOMContentReady considered anti-pattern by Google

后端 未结 7 2241
广开言路
广开言路 2020-12-08 05:20

A Google Closure library team member asserts that waiting for DOMContentReady event is a bad practice.

The short story is that we don\'t want to wai

7条回答
  •  轮回少年
    2020-12-08 05:40

    If the time it takes to parse, load, and render layout (the point at which domready should fire) without consideration for image loads takes so long that it causes noticeable UI delay, you've probably got something really ugly building that page on the back-end, and that's your real problem.

    Furthermore, JavaScript before the end of the page halts HTML parsing/DOM evaluating until the JS is parsed and evaluated. Google should look to their Java before giving advice on JavaScript.

提交回复
热议问题