@@ -137,6 +137,8 @@ time providing implementations with a better signal of user intent.
137
137
138
138
readonly attribute boolean isValid;
139
139
readonly attribute PermissionElementBlockerReason invalidReason;
140
+ readonly attribute PermissionState initialPermissionStatus;
141
+ readonly attribute PermissionState permissionStatus;
140
142
141
143
static boolean isTypeSupported(DOMString type);
142
144
@@ -235,6 +237,10 @@ The <{permission}> element has the following internal slots:
235
237
{{HTMLPermissionElement/onvalidationstatuschange}} event needs to be
236
238
dispatches.
237
239
240
+ * <dfn attribute for="HTMLPermissionElement">\[[InitialPermissionStatus]]</dfn>
241
+ is a {{PermissionState}} that stores the initial {{PermissionState}} for
242
+ {{[[Types]]}} .
243
+
238
244
## <{permission}> -supporting state at the [=/navigable=] ## {#permission-element-external-state}
239
245
240
246
In order to support the <{permission}> element, the [=/navigable=] maintains
@@ -291,6 +297,8 @@ The HTMLPermissionElement's {{HTMLPermissionElement/type}} setter steps are:
291
297
input string.
292
298
1. If |features| is None, return.
293
299
1. [=list/Append=] each [=powerful feature=] name to the {{[[Types]]}} [=ordered set=] .
300
+ 1. Set {{[[InitialPermissionStatus]]}} to the result of
301
+ [=HTMLPermissionElement/get the current permission state=] .
294
302
295
303
Note: The supported sets of [=powerful features=] is [=implementation-defined=] .
296
304
</div>
@@ -517,6 +525,8 @@ The {{HTMLPermissionElement}} constructor steps are:
517
525
1. Initialize the internal {{[[LastNotifiedValidState]]}} with false.
518
526
1. Initialize the internal {{[[LastNotifiedInvalidReason]]}} with the empty
519
527
string.
528
+ 1. Initialize the internal {{[[InitialPermissionStatus]]}} to
529
+ the result of [=HTMLPermissionElement/get the current permission state=] .
520
530
521
531
</div>
522
532
@@ -569,6 +579,25 @@ HTMLPermissionElement |element|'s <dfn attribute for="HTMLPermissionElement">inv
569
579
570
580
</div>
571
581
582
+ <div algorithm>
583
+ HTMLPermissionElement |element|'s
584
+ <dfn attribute for="HTMLPermissionElement">initialPermissionStatus</dfn>
585
+ getter steps are:
586
+
587
+ 1. Return |element|'s internal {{[[InitialPermissionStatus]]}} .
588
+
589
+ </div>
590
+
591
+ <div algorithm>
592
+ HTMLPermissionElement |element|'s
593
+ <dfn attribute for="HTMLPermissionElement">permissionStatus</dfn>
594
+ getter steps are:
595
+
596
+ 1. Return [=HTMLPermissionElement/get the current permission state=] for
597
+ |element|.
598
+
599
+ </div>
600
+
572
601
<div algorithm=activation>
573
602
A <{permission}> |element|'s [=EventTarget/activation behavior=] given |event| is:
574
603
@@ -651,6 +680,30 @@ To <dfn for="HTMLPermissionElement">recheck type permissibility</dfn> for a
651
680
652
681
</div>
653
682
683
+ <div algorithm>
684
+ To <dfn for="HTMLPermissionElement">get the current permission state</dfn> for
685
+ an {{HTMLPermissionElement}} |element|:
686
+
687
+ 1. Let |types| be |element|'s internal {{[[Types]]}} .
688
+ 1. If |types| is null or |types| is [=list/empty=] ,
689
+ return {{PermissionState/prompt}} .
690
+ 1. Let |current| be {{PermissionState/granted}} .
691
+ 1. [=list/iterate|For each=] |type| of |types|:
692
+ 1. Let |state| be the result of [=/get the current permission state=] for
693
+ |type|.
694
+ 1. Let |current| be the smaller of |current| and |state|, assuming the
695
+ following ordering:
696
+ {{PermissionState/granted}} >
697
+ {{PermissionState/prompt}} >
698
+ {{PermissionState/denied}} .
699
+ 1. Return |current|.
700
+
701
+ ISSUE: It's not clear what the PermissionState for 'no valid permission type'
702
+ should be. Here I pick "prompt" based on Chrome's implementation; but that
703
+ choice is arbitrary.
704
+
705
+ </div>
706
+
654
707
## <{permission}> element event algorithms ## {#events}
655
708
656
709
<div algorithm>
0 commit comments