Skip to content

Commit

Permalink
Implement the "not" condition support (w3c#1711)
Browse files Browse the repository at this point in the history
* Implement the "not" condition support

* Omit unnecessary space

* Remove unnecessary '_' from 'not'.
  • Loading branch information
yoshisatoyanagisawa authored Apr 16, 2024
1 parent e89eaed commit 8d64a5c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1578,6 +1578,7 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/
RunningStatus runningStatus;

sequence<RouterCondition> _or;
RouterCondition not;
};

typedef (RouterSourceDict or RouterSourceEnum) RouterSource;
Expand Down Expand Up @@ -3394,6 +3395,13 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/
1. For each |orCondition| of |orConditions|:
1. If running the [=Verify Router Condition=] algorithm with |orCondition| and |serviceWorker| returns false, return false.
1. Set |hasCondition| to true.
1. If |condition|["{{RouterCondition/not}}"] [=map/exists=], then:
1. If |hasCondition| is true, return false.

Note: For ease of understanding the router rule, the "not" condition is mutually exclusive with other conditions.

1. If running the [=Verify Router Condition=] algorithm with |condition|["{{RouterCondition/not}}"] and |serviceWorker| returns false, return false.
1. Set |hasCondition| to true.
1. Return |hasCondition|.
</section>

Expand All @@ -3413,6 +3421,9 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/
1. For each |orCondition| of |orConditions|:
1. If running the [=Match Router Condition=] algorithm with |orCondition|, |serviceWorker| and |request| returns true, then return true.
1. Return false.
1. If |condition|["{{RouterCondition/not}}"] [=map/exists=], then:
1. If running the [=Match Router Condition=] algorithm with |condition|["{{RouterCondition/not}}"], |serviceWorker| and |request| returns true, then return false.
1. Return true.
1. Else:

Note: The [=Verify Router Condition=] algorithm guarantees that {{RouterCondition/or}} and other conditions are mutual exclusive.
Expand Down

0 comments on commit 8d64a5c

Please sign in to comment.