Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NOT READY FOR COMMIT] Initial draft: HTMLPermissionElement definition. #31

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Prev Previous commit
Redo unsucessful_registration.
  • Loading branch information
otherdaniel committed Sep 17, 2024
commit 13b8e97f7b5082b4dd14dd8bfe5d54d9a76cf662
51 changes: 35 additions & 16 deletions permission-element.bs
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,6 @@ The <{permission}> element has the following internal slots:
{{DOMRectReadOnly}} that stores the most recently seen intersection, i.e.
the position of the <{permission}> relative to the [=viewport=].

## <{permission}> element-related state maintained by the [=document=] ## {#permission-element-per-document-state}

The [=document=] gains the following internal slot:

* The <dfn attribute for="HTMLDocument">\[[PermissionElementTypeMap]]</dfn> is
an [=ordered set=] of [=powerful features=]. It is initialized with the
empty list, &laquo;[]&raquo;.

## <{permission}> element interesting behaviours ## {#permission-element-very-interesting}

The <{permission}> element has a few surprising behaviours, to support its
Expand Down Expand Up @@ -463,12 +455,8 @@ The {{HTMLPermissionElement}} [=insertion steps=] are:
1. Call {{[[IntersectionObserver]]}}.observe([=this=]).
1. If {{[[Types]]}} [=list/is empty=], then [=add a permanent blocker=]
with reason {{PermissionElementBlockerReason/type_invalid}}.
1. If the [=set/intersection=] of {{[[Types]]}} and [=document=]'s
{{[[PermissionElementTypeMap]]}} is not [=list/is empty|empty=], then
[=add a permanent blocker=] with reason
{{PermissionElementBlockerReason/unsuccesful_registration}}.
1. [=list/Extend=] [=document=]'s {{[[PermissionElementTypeMap]]}} with
{{[[Types]]}}.
1. If [=this=] is not [=type permissible=], then [=add a temporary blocker=]
with {{PermissionElementBlockerReason/unsuccesful_registration}}.
1. [=Add an expiring blocker=] with reason
{{PermissionElementBlockerReason/recently_attached}}.
1. If the [=navigable/traversable navigable=] of the [=node navigable=] of
Expand All @@ -481,8 +469,7 @@ The {{HTMLPermissionElement}} [=insertion steps=] are:
<div algorithm="HTMLPermissionElement/removing steps">
The {{HTMLPermissionElement}} [=removing steps=] are:

1. [=list/For each=] |type| in {{[[Types]]}}:
1. [=list/Remove=] |type| from [=document=]'s {{[[PermissionElementTypeMap]]}}
1. [=Recheck type permissibility=] for [=this=]'s [=node document=].

</div>

Expand Down Expand Up @@ -542,5 +529,37 @@ The HTMLPermissionElement's <dfn for="HTMLPermissionElement">IntersectionObserve
ISSUE: Do I need to define dictionary equality?
</div>

<div algorithm>
To determine whether an |element| is <dfn for="HTMLPermissionElement">type permissible</dfn>:

1. Let |allthepepcies| be &laquo;[ ]&raquo;
1. [=list/iterate|For each=] |navigable| in
[=inclusive descendant navigables=] of |element|'s [=node document=]:
1. Let |doc| be |navigable|'s [=container document=]
1. [=list/Extend=] |allthepepcies| with
|doc|.{{Document/getElementsByTagName()|getElementsByTagName}}("permission").
1. [=list/iterate|For each=] |pepc| of |allthepepcies|:
1. If the [=set/intersection=] of |element|.{{[[Types]]}} with
|pepc|.{{[[Types]]}} is not empty, then return false.
1. Return true.

</div>

<div algorithm>
To <dfn for="HTMLPermissionElement">recheck type permissibility</dfn> for a
|document|:

1. Let |allthepepcies| be &laquo;[ ]&raquo;
1. [=list/iterate|For each=] |navigable| in
[=inclusive descendant navigables=] of |document|:
1. Let |doc| be |navigable|'s [=container document=]
1. [=list/Extend=] |allthepepcies| with
|doc|.{{Document/getElementsByTagName()|getElementsByTagName}}("permission").
1. [=list/iterate|For each=] |pepc| of |allthepepcies|:
1. If |pepc| is [=type permissible=], then [=remove blockers=] with
{{PermissionElementBlockerReason/unsuccesful_registration}} from |pepc|.

</div>

# CSS Integration # {#algorithms}
# Security & Privacy Considerations # {#secpriv}
Loading