Skip to content

Commit 2d9aee6

Browse files
committed
deploy: 12d02ab
1 parent f5f913d commit 2d9aee6

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

index.html

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<link href="https://www.w3.org/StyleSheets/TR/2021/W3C-ED" rel="stylesheet">
88
<meta content="Bikeshed version d765c696b, updated Fri Mar 8 15:58:52 2024 -0800" name="generator">
99
<link href="https://www.w3.org/TR/design-principles/" rel="canonical">
10-
<meta content="222226d1981faaab99ccfe4d2a61548a8e6be80a" name="revision">
10+
<meta content="12d02abe2402b75bd308c0f502ba6e3dcc1fe55c" name="revision">
1111
<meta content="dark light" name="color-scheme">
1212
<link href="https://www.w3.org/StyleSheets/TR/2021/dark.css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css">
1313
<style>
@@ -701,7 +701,7 @@
701701
<div class="head">
702702
<p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2021/logos/W3C" width="72"> </a> </p>
703703
<h1 class="p-name no-ref" id="title">Web Platform Design Principles</h1>
704-
<p id="w3c-state"><a href="https://www.w3.org/standards/types#ED">Editor’s Draft</a>, <time class="dt-updated" datetime="2024-03-11">11 March 2024</time></p>
704+
<p id="w3c-state"><a href="https://www.w3.org/standards/types#ED">Editor’s Draft</a>, <time class="dt-updated" datetime="2024-04-01">1 April 2024</time></p>
705705
<details open>
706706
<summary>More details about this document</summary>
707707
<div data-fill-with="spec-metadata">
@@ -831,7 +831,7 @@ <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
831831
<a href="#event-design"><span class="secno">7</span> <span class="content">Event Design</span></a>
832832
<ol class="toc">
833833
<li><a href="#one-time-events"><span class="secno">7.1</span> <span class="content">Use promises for one time events</span></a>
834-
<li><a href="#promises-and-events"><span class="secno">7.2</span> <span class="content">Events should fire before Promises resolve</span></a>
834+
<li><a href="#promises-and-events"><span class="secno">7.2</span> <span class="content">Events should fire before related Promises resolve</span></a>
835835
<li><a href="#dont-invent-event-like"><span class="secno">7.3</span> <span class="content">Don’t invent your own event listener-like infrastructure</span></a>
836836
<li><a href="#always-add-event-handlers"><span class="secno">7.4</span> <span class="content">Always add event handler attributes</span></a>
837837
<li><a href="#events-are-for-notification"><span class="secno">7.5</span> <span class="content">Use events for notification</span></a>
@@ -2281,15 +2281,18 @@ <h2 class="heading settled" data-level="7" id="event-design"><span class="secno"
22812281
<h3 class="heading settled" data-level="7.1" id="one-time-events"><span class="secno">7.1. </span><span class="content">Use promises for one time events</span><a class="self-link" href="#one-time-events"></a></h3>
22822282
<p>Follow the <a href="https://www.w3.org/2001/tag/doc/promises-guide#one-time-events">advice</a> in the <strong><a href="https://www.w3.org/2001/tag/doc/promises-guide">Writing
22832283
Promise-Using Specifications</a></strong> guideline.</p>
2284-
<h3 class="heading settled" data-level="7.2" id="promises-and-events"><span class="secno">7.2. </span><span class="content">Events should fire before Promises resolve</span><a class="self-link" href="#promises-and-events"></a></h3>
2284+
<h3 class="heading settled" data-level="7.2" id="promises-and-events"><span class="secno">7.2. </span><span class="content">Events should fire before related Promises resolve</span><a class="self-link" href="#promises-and-events"></a></h3>
22852285
<p>If a Promise-based asynchronous algorithm dispatches events,
22862286
it should dispatch them before the Promise resolves,
22872287
rather than after.</p>
2288-
<p>This guarantees that once the Promise resolves,
2289-
all effects of the algorithm have been applied.
2290-
For example, if an author changes some state
2291-
in reaction to an event which the Promise dispatches,
2292-
they can be sure that all of the state is consistent if the Promise is resolved.</p>
2288+
<p>When a promise is resolved, a <a href="https://html.spec.whatwg.org/multipage/webappapis.html#microtask">microtask</a> is queued to run its reaction callbacks.
2289+
Microtasks are processed when the JavaScript stack empties. <a href="https://dom.spec.whatwg.org/#dispatching-events">Dispatching an event</a> is synchronous,
2290+
which involves the JavaScript stack emptying between each listener.
2291+
As a result, if a promise is resolved before dispatching a related event,
2292+
any microtasks that are scheduled in reaction to a promise
2293+
will be invoked between the first and second listeners of the event.</p>
2294+
<p>Dispatching the event first prevents this interleaving.
2295+
All event listeners are then invoked before any promise reaction callbacks.</p>
22932296
<h3 class="heading settled" data-level="7.3" id="dont-invent-event-like"><span class="secno">7.3. </span><span class="content">Don’t invent your own event listener-like infrastructure</span><a class="self-link" href="#dont-invent-event-like"></a></h3>
22942297
<p>When creating an API which allows authors to start and stop a process which generates notifications,
22952298
use the existing event infrastructure to allow listening for the notifications.
@@ -4201,7 +4204,7 @@ <h3 class="no-num no-ref heading settled" id="informative"><span class="content"
42014204
<dt id="biblio-appmanifest">[APPMANIFEST]
42024205
<dd>Marcos Caceres; et al. <a href="https://w3c.github.io/manifest/"><cite>Web Application Manifest</cite></a>. URL: <a href="https://w3c.github.io/manifest/">https://w3c.github.io/manifest/</a>
42034206
<dt id="biblio-credential-management-1">[CREDENTIAL-MANAGEMENT-1]
4204-
<dd>Mike West. <a href="https://w3c.github.io/webappsec-credential-management/"><cite>Credential Management Level 1</cite></a>. URL: <a href="https://w3c.github.io/webappsec-credential-management/">https://w3c.github.io/webappsec-credential-management/</a>
4207+
<dd>Nina Satragno. <a href="https://w3c.github.io/webappsec-credential-management/"><cite>Credential Management Level 1</cite></a>. URL: <a href="https://w3c.github.io/webappsec-credential-management/">https://w3c.github.io/webappsec-credential-management/</a>
42054208
<dt id="biblio-css-backgrounds-3">[CSS-BACKGROUNDS-3]
42064209
<dd>Elika Etemad; Brad Kemper. <a href="https://drafts.csswg.org/css-backgrounds/"><cite>CSS Backgrounds and Borders Module Level 3</cite></a>. URL: <a href="https://drafts.csswg.org/css-backgrounds/">https://drafts.csswg.org/css-backgrounds/</a>
42074210
<dt id="biblio-css-fonts-4">[CSS-FONTS-4]

0 commit comments

Comments
 (0)