Skip to content

Commit 45bcc23

Browse files
some refactor
1 parent b1273e2 commit 45bcc23

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

index.bs

Lines changed: 22 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,13 @@ 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. Set [=navigable to locale overrides map=][|navigable|] to |locale|.
5801+
5802+
</div>
5803+
57935804
<div algorithm="remote end steps for emulation.setLocaleOverride">
57945805

57955806
The [=remote end steps=] with |command parameters| are:
@@ -5811,17 +5822,12 @@ The [=remote end steps=] with |command parameters| are:
58115822
1. If [=IsStructurallyValidLanguageTag=](|emulated locale|) returns false,
58125823
return [=error=] with [=error code=] [=invalid argument=].
58135824

5825+
1. Let |navigables| be a [=/set=].
5826+
58145827
1. If the <code>contexts</code> field of |command parameters| is present:
58155828

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

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-
58255831
1. Otherwise, if the <code>userContexts</code> field of |command parameters| is present:
58265832

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

5843+
1. [=list/For each=] |top-level traversable| of the list of all [=/top-level traversables=]
5844+
whose [=associated user context=] is |user context|:
5845+
5846+
1. [=list/Append=] |top-level traversable| to |navigables|.
5847+
5848+
1. For each |navigable| of |navigables|:
5849+
5850+
1. [=Set emulated locale=] with |navigable| and |locale|.
5851+
58375852
1. Return [=success=] with data null.
58385853

58395854
</div>

0 commit comments

Comments
 (0)