Skip to content

Commit 973be71

Browse files
LeaVeroujakearchibaldcynthiaatanassov
authored
New principle: Avoid introducing new parser-blocking features, fixes #329 (#347)
* New principle: Avoid introducing new parser-blocking features, fixes #329 Co-Authored-By: Jake Archibald < [email protected]> * Update index.bs * Update index.bs Co-authored-by: Rossen Atanassov <[email protected]> * Editorial fixes for improved readability * Editorial changes for improved readability * Fixing markup * Fixing markup Co-authored-by: Jake Archibald < [email protected]> Co-authored-by: Sangwhan "fish" Moon <[email protected]> Co-authored-by: Rossen Atanassov <[email protected]>
1 parent 3830de1 commit 973be71

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

index.bs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,34 @@ the functionality you are adding is **not** similar to that of the existing attr
929929
This is an antipattern; one of these groups of attributes should have had a different name.
930930
</div>
931931

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+
932960
<h2 id="css">Cascading Style Sheets (CSS)</h2>
933961

934962
This section details design principles for features which are exposed via CSS.

0 commit comments

Comments
 (0)