@@ -138,6 +138,8 @@ time providing implementations with a better signal of user intent.
138
138
readonly attribute boolean isValid;
139
139
readonly attribute PermissionElementBlockerReason invalidReason;
140
140
141
+ static boolean isTypeSupported(DOMString type);
142
+
141
143
attribute EventHandler onpromptaction;
142
144
attribute EventHandler onpromptdismiss;
143
145
attribute EventHandler onvalidationstatuschange;
@@ -166,6 +168,15 @@ The {{HTMLPermissionElement/invalidReason}} attribute is an
166
168
[=enumerated attribute=] that reflects the internal state of the permission
167
169
element. It's value set are {{PermissionElementBlockerReason}}
168
170
171
+ The {{HTMLPermissionElement/isTypeSupported}} [=static operation=] whether a
172
+ gives {{HTMLPermissionElement/type}} , that is, a given
173
+ [=enumerated attribute|enumeration=] of [=powerful features=] , is supported.
174
+ It predicts whether creating a <{permission}> element and assigning the given
175
+ {{HTMLPermissionElement/type}} string will work, or whether it will create
176
+ an element blocked by a {{PermissionElementBlockerReason/type_invalid}}
177
+ [=permanent blocker=] .
178
+
179
+
169
180
The global <a attribute spec=html for=HTMLElement>lang</a> attribute is
170
181
observed by the <{permission}> element to select localized text.
171
182
@@ -276,14 +287,37 @@ The HTMLPermissionElement's {{HTMLPermissionElement/type}} setter steps are:
276
287
277
288
1. If {{[[Types]]}} is not null: Return.
278
289
1. Set {{[[Types]]}} to «[]».
279
- 1. Parse the input as a string of [=powerful feature =] names, seperated by whitespace.
280
- 1. If any errors occured, return .
281
- 1. Check if the set of [=powerful features=] is supported for the {{HTMLPermissionElement}} by the [=user agent=] . If not , return.
290
+ 1. Let |features| be the result of calling [=parse a type string =] with the
291
+ input string .
292
+ 1. If | features| is None , return.
282
293
1. [=list/Append=] each [=powerful feature=] name to the {{[[Types]]}} [=ordered set=] .
283
294
284
295
Note: The supported sets of [=powerful features=] is [=implementation-defined=] .
285
296
</div>
286
297
298
+ To query whether a feature (or group of features) is supported:
299
+
300
+ <div algorithm="HTMLPermissionElement/isTypeSupported()">
301
+ HTMLPermissionElement's {{HTMLPermissionElement/isTypeSupported()}} method
302
+ steps with argument with {{DOMString}} |type|are:
303
+
304
+ 1. Let |features| be the result of calling [=parse a type string=] with |type|.
305
+ 1. Return whether |features| is not None.
306
+
307
+ </div>
308
+
309
+ <div algorithm>
310
+ To <dfn>parse a type string</dfn> a given string |type|:
311
+
312
+ 1. Let |list| be the result of parsing |type| as a string of
313
+ [=powerful feature=] names, seperated by whitespace.
314
+ 1. If any errors occured, return None.
315
+ 1. Check if the set of [=powerful features=] is supported for the
316
+ {{HTMLPermissionElement}} by the [=user agent=] . If not, return None.
317
+ 1. Return |list|.
318
+
319
+ </div>
320
+
287
321
### Activation blockers ### {#permission-element-activation-blockers}
288
322
289
323
The key goal of the <{permission}> element is to reflect a user's conscious
0 commit comments