@@ -929,6 +929,34 @@ the functionality you are adding is **not** similar to that of the existing attr
929
929
This is an antipattern; one of these groups of attributes should have had a different name.
930
930
</div>
931
931
932
+ <h3 id="avoid-html-parser-blocking"> Do not pause the HTML parser</h3>
933
+
934
+ Ensure that your design does not require HTML parser to pause to handle external resources.
935
+
936
+ As a page parses,
937
+ the browser discovers assets that the page needs,
938
+ and figures out a priority in which they should be loaded in parallel.
939
+ Such parsing can be disrupted by a resource which blocks the discovery of subsequent resources.
940
+ At worst, it means the browser downloads items in series rather than parallel.
941
+ At best, it means the browser queues downloads based on speculative parsing,
942
+ which may turn out to be incorrect.
943
+
944
+ Features that block the parser generally do so
945
+ because they want to feed additional content into the parser
946
+ before subsequent content.
947
+ This is the case of legacy `<script src="…"> ` elements,
948
+ which can inject into the parser using `document.write(…)`.
949
+ Due to the performance issues above, new features must not do this.
950
+
951
+ <h3 id="avoid-render-blocking"> Avoid features that block rendering</h3>
952
+
953
+ Features that require resource loading or other operations before rendering the page,
954
+ often result in blank page (or the previous page). The result is a poor user experience.
955
+
956
+ Consider adding such features only in cases when the overall user experience is improved.
957
+ A canonical example of this is blocking rendering in order to download and process a stylesheet.
958
+ The alternative user experience is a flash of unstyled content, which is undesirable.
959
+
932
960
<h2 id="css">Cascading Style Sheets (CSS)</h2>
933
961
934
962
This section details design principles for features which are exposed via CSS.
0 commit comments