@@ -206,6 +206,12 @@ The <{permission}> element has the following internal slots:
206206 {{DOMRectReadOnly}} that stores the most recently seen intersection, i.e.
207207 the position of the <{permission}> relative to the [=viewport=] .
208208
209+ * <dfn attribute for="HTMLPermissionElement">\[[LastNotifiedValidState]]</dfn>
210+ is a [=boolean=] that stores the most recently notified state of
211+ {{HTMLPermissionElement/isValid}} . This is used to determine whether
212+ an {{HTMLPermissionElement/onvalidationstatuschange}} event needs to
213+ be thrown.
214+
209215## <{permission}> -supporting state at the [=/navigable=] ## {#permission-element-external-state}
210216
211217In order to support the <{permission}> element, the [=/navigable=] maintains
@@ -462,6 +468,7 @@ The {{HTMLPermissionElement}} constructor steps are:
462468
4634691. Initialize the internal {{[[Types]]}} slot to null.
4644701. Initialize the internal {{[[BlockerList]]}} to «[]».
471+ 1. Initialize the internal {{[[LastNotifiedValidState]]}} with false.
465472
466473</div>
467474
@@ -486,6 +493,7 @@ The {{HTMLPermissionElement}} [=insertion steps=] are:
486493 [=this=]
487494 is a [=fenced navigable=] , then [=add a permanent blocker=]
488495 with {{PermissionElementBlockerReason/illegal_subframe}} .
496+ 1. [=Maybe trigger an onvalidstatechange event=] on [=this=] .
489497
490498</div>
491499
@@ -494,6 +502,7 @@ The {{HTMLPermissionElement}} [=removing steps=] are:
494502
4955031. [=list/Remove=] [=this=] from [=node navigable=] 's {{[[PermissionElements]]}} .
4965041. [=Recheck type permissibility=] for [=this=] 's [=node navigable=] .
505+ 1. [=Maybe trigger an onvalidstatechange event=] on [=this=] .
497506
498507</div>
499508
@@ -519,10 +528,14 @@ A <{permission}> |element|'s [=EventTarget/activation behavior=] given |event| i
5195281. If |element|'s {{[[Types]]}} [=list/is empty=] , then return.
5205291. If |event|.{{Event/isTrusted}} is false, then return.
5215301. If |element|.{{HTMLPermissionElement/isValid}} is false, then return.
522- 1. [=Request permission to use=] the [=powerful features=] named in |element|'s
523- {{[[Types]]}} .
531+ 1. [=Request permission to use=] the [=powerful features=] named in
532+ |element|'s {{[[Types]]}} .
533+ 1. [=Dispatch onresolve=] on [=this=] .
524534
525535Issue: What about event handlers?
536+
537+ Issue: What about dismissal? The Permission spec doesn't seem to know about
538+ dismissals.
526539</div>
527540
528541<div algorithm="HTMLPermissionElement/IntersectionObserver callback">
@@ -549,6 +562,7 @@ The HTMLPermissionElement's <dfn for="HTMLPermissionElement">IntersectionObserve
549562 {{PermissionElementBlockerReason/intersection_changed}} .
5505631. Set {{[[IntersectionRect]]}} to
551564 |entry|.{{IntersectionObserverEntry/intersectionRect}}
565+ 1. [=Maybe trigger an onvalidstatechange event=] on [=this=] .
552566
553567ISSUE: Do I need to define dictionary equality?
554568</div>
@@ -581,6 +595,35 @@ To <dfn for="HTMLPermissionElement">recheck type permissibility</dfn> for a
581595
582596</div>
583597
598+ ## <{permission}> element event algorithms ## {#events}
599+
600+ <div algorithm>
601+ To <dfn for=HTMLPermissionElement>maybe trigger an onvalidstatechange
602+ event</dfn> for |element|:
603+
604+ 1. Let |old| be {{[[LastNotifiedValidState]]}} .
605+ 1. Let |new| be whether |element|’s [=blocker=] is Nothing.
606+ 1. Set {{[[LastNotifiedValidState]]}} to |new|.
607+ 1. If |old| != |new|, then:
608+ 1. Let |event| be a new {{Event}} .
609+ 1. [=Event/Initialize=] |event| with
610+ type "{{HTMLPermissionElement/onvalidationstatuschange}} ",
611+ bubbles as true, and
612+ canceable as true.
613+ 1. [=/Dispatch=] |event| to |element|.
614+
615+ </div>
616+
617+ <div algorithm>
618+ To <dfn for=HTMLPermisssionElement>dispatch onresolve</dfn> for |element|:
619+
620+ 1. Let |event| be a new {{Event}} .
621+ 1. [=Event/Initialize=] |event| with type "{{HTMLPermissionElement/onresolve}} ",
622+ bubbles as true, and canceable as true.
623+ 1. [=/Dispatch=] |event| to |element|.
624+
625+ </div>
626+
584627# Rendering the <{permission}> Element # {#rendering}
585628
586629The <{permission}> element is a [=non-devolvable widget=] and is chiefly
0 commit comments