Skip to content

Commit 5c76573

Browse files
some refactor
1 parent b1273e2 commit 5c76573

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

index.bs

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4820,6 +4820,10 @@ TODO: Move it as a hook in the html spec instead.
48204820
1. If [=geolocation overrides map=] [=map/contains=] |user context|,
48214821
[=set emulated position data=] with |navigable| and [=geolocation overrides map=][|user context|].
48224822

4823+
1. If [=user context to locale overrides map=] [=map/contains=] |user context|,
4824+
[=set emulated locale=] with |navigable| and
4825+
[=user context to locale overrides map=][|user context|].
4826+
48234827
1. If [=viewport overrides map=] [=map/contains=] |user context|:
48244828

48254829
1. If |navigable| is a [=/top-level traversable=] and the <code>viewport</code> field of
@@ -5790,6 +5794,17 @@ locale on the given top-level traversables or user contexts.
57905794
</dd>
57915795
</dl>
57925796

5797+
<div>
5798+
To <dfn>set emulated locale</dfn> given |navigable| and |locale|:
5799+
5800+
1. If |emulated locale| is null, [=map/remove=] |navigable| from
5801+
[=navigable to locale overrides map=].
5802+
5803+
1. Otherwise, [=map/set=] [=navigable to locale overrides map=][|navigable|] to
5804+
|locale|.
5805+
5806+
</div>
5807+
57935808
<div algorithm="remote end steps for emulation.setLocaleOverride">
57945809

57955810
The [=remote end steps=] with |command parameters| are:
@@ -5811,17 +5826,12 @@ The [=remote end steps=] with |command parameters| are:
58115826
1. If [=IsStructurallyValidLanguageTag=](|emulated locale|) returns false,
58125827
return [=error=] with [=error code=] [=invalid argument=].
58135828

5829+
1. Let |navigables| be a [=/set=].
5830+
58145831
1. If the <code>contexts</code> field of |command parameters| is present:
58155832

58165833
1. Let |navigables| be the result of [=trying=] to [=get valid top-level traversables by ids=] with |command parameters|["<code>contexts</code>"].
58175834

5818-
1. For each |navigable| of |navigables|:
5819-
5820-
1. If |emulated locale| is null, [=map/remove=] |navigable| from
5821-
[=navigable to locale overrides map=].
5822-
5823-
1. Otherwise, [=map/set=] [=navigable to locale overrides map=][|navigable|] to |locale|.
5824-
58255835
1. Otherwise, if the <code>userContexts</code> field of |command parameters| is present:
58265836

58275837
1. Let |user contexts| be the result of [=trying=] to [=get valid user contexts=] with |command parameters|["<code>userContexts</code>"].
@@ -5834,6 +5844,15 @@ The [=remote end steps=] with |command parameters| are:
58345844
1. Otherwise, [=user context to locale overrides map=][|user context|] to
58355845
|locale|.
58365846

5847+
1. [=list/For each=] |top-level traversable| of the list of all [=/top-level traversables=]
5848+
whose [=associated user context=] is |user context|:
5849+
5850+
1. [=list/Append=] |top-level traversable| to |navigables|.
5851+
5852+
1. For each |navigable| of |navigables|:
5853+
5854+
1. [=Set emulated locale=] with |navigable| and |locale|.
5855+
58375856
1. Return [=success=] with data null.
58385857

58395858
</div>

0 commit comments

Comments
 (0)