Skip to content

Commit 2e67d60

Browse files
committed
Clarify matched clients order
This improves clients.matchAll(options) with clarifying how to order the non-window Client objects. As it has been, window clients always come first in the most recently focused order. Then, window clients that have never been focused (e.g. reserved environment during navigation) come in their creation order. And worker clients are placed next in their creation order. Fixes #887
1 parent 2e80222 commit 2e67d60

File tree

4 files changed

+84
-48
lines changed

4 files changed

+84
-48
lines changed

docs/index.bs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
12701270
</ol>
12711271
</li>
12721272
<li>Let <var>matchedClients</var> be an empty array.</li>
1273-
<li>For each <a href="#dfn-service-worker-client">service worker client</a> <var>client</var> in <var>targetClients</var>, in the most recently <a lt="focusing steps">focused</a> order for <a href="#dfn-window-client">window clients</a>:
1273+
<li>For each <a href="#dfn-service-worker-client">service worker client</a> <var>client</var> in <var>targetClients</var>:
12741274
<ol>
12751275
<li>If <var>options</var>.{{ClientQueryOptions/type}} is "<code>window</code>" or "<code>all</code>", and <var>client</var> is a type of <a>environment</a> or is a <a href="#dfn-window-client">window client</a>, then:
12761276
<ol>
@@ -1309,6 +1309,13 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
13091309
</li>
13101310
</ol>
13111311
</li>
1312+
<li>Sort <var>matchedClients</var> such that:
1313+
<ul>
1314+
<li>{{WindowClient}} objects are always placed before {{Client}} objects whose associated <a for="Client">service worker clients</a> are <a>worker clients</a>.</li>
1315+
<li>{{WindowClient}} objects that have been <a lt="focusing steps">focused</a> are placed first sorted in the most recently <a lt="focusing steps">focused</a> order, and {{WindowClient}} objects that have never been <a lt="focusing steps">focused</a> are placed next sorted in their <a for="Client">service worker clients</a>' creation order.</li>
1316+
<li>{{Client}} objects whose associated <a for="Client">service worker clients</a> are <a>worker clients</a> are placed next sorted in their <a for="Client">service worker clients</a>' creation order.</li>
1317+
</ul>
1318+
</li>
13121319
<li>Resolve <var>promise</var> with <var>matchedClients</var>.</li>
13131320
</ol>
13141321
</li>

0 commit comments

Comments
 (0)