@@ -124,15 +124,27 @@ the <a>notification</a>, but then it should have less visual priority than the
124
124
is not otherwise accessible to the end user, especially since notification platforms that do not
125
125
support these features might ignore them.
126
126
127
- <p> A <a>notification</a> has an associated list of
128
- zero or more <dfn for=notification lt=action id=actions>actions</dfn> . Each
129
- <a for=notification>action</a> has an associated
130
- <dfn for=action id=action-title>title</dfn> and <dfn for=action id=action-name>name</dfn> and
131
- <em> can</em> have an associated <dfn for=action>icon URL</dfn> and
132
- <dfn for=action>icon resource</dfn> . Users may activate actions, as alternatives to
133
- activating the notification itself. The user agent must determine the
134
- <dfn>maximum number of actions</dfn> supported, within the constraints of the
135
- notification platform.
127
+ <p> A <a>notification</a> has associated <dfn for=notification id=actions>actions</dfn> (a
128
+ <a for=/>list</a> of zero or more <a for=/>actions</a> ). An <dfn>action</dfn> represents a choice
129
+ for an end user. Each <a for=/>action</a> has an associated:
130
+
131
+ <dl>
132
+ <dt> <dfn for=action id=action-title>title</dfn>
133
+ <dd> A string.
134
+
135
+ <dt> <dfn for=action id=action-name>name</dfn>
136
+ <dd> A string.
137
+
138
+ <dt> <dfn for=action>icon URL</dfn>
139
+ <dd> Null or a <a for=/>URL</a> . It is initially null.
140
+
141
+ <dt> <dfn for=action>icon resource</dfn>
142
+ <dd> Null or a resource. It is initially null.
143
+ </dl>
144
+
145
+ <p> Users may activate actions, as alternatives to activating the notification itself. The
146
+ <dfn>maximum number of actions</dfn> supported is an <a>implementation-defined</a> integer of zero
147
+ or more, within the constraints of the notification platform.
136
148
137
149
<p class=note> Since display of actions is platform-dependent, developers are
138
150
encouraged to make sure that any action a user can invoke from a notification is
@@ -239,13 +251,14 @@ string <var>title</var>, {{NotificationOptions}} <a for=/>dictionary</a> <var>op
239
251
<li><p> Set <var> notification</var> 's <a for=notification>require interaction preference</a> to
240
252
<var> options</var> ["{{NotificationOptions/requireInteraction}}"] .
241
253
254
+ <li><p> Set <var> notification</var> 's <a for=notification>actions</a> to « ».
255
+
242
256
<li>
243
- <p> Set <var> notification</var> 's list of <a>actions</a> to an empty list, then for each
244
- <var> entry</var> in <var> options</var> ["{{NotificationOptions/actions}}"] , up to the
257
+ <p> For each <var> entry</var> in <var> options</var> ["{{NotificationOptions/actions}}"] , up to the
245
258
<a>maximum number of actions</a> supported (skip any excess entries):
246
259
247
260
<ol>
248
- <li><p> Let <var> action</var> be a new <a lt="actions" >action</a> .
261
+ <li><p> Let <var> action</var> be a new <a for=/ >action</a> .
249
262
250
263
<li><p> Set <var> action</var> 's <a for=action>name</a> to
251
264
<var> entry</var> ["{{NotificationAction/action}}"] .
@@ -256,9 +269,9 @@ string <var>title</var>, {{NotificationOptions}} <a for=/>dictionary</a> <var>op
256
269
<li><p> If <var> entry</var> ["{{NotificationAction/icon}}"] <a for=map>exists</a> , then
257
270
<a lt="url parser">parse</a> it using <var> baseURL</var> , and if that does not return failure,
258
271
set <var> action</var> 's <a for=action>icon URL</a> to the return value. (Otherwise
259
- <a for=action>icon URL</a> is not set .)
272
+ <a for=action>icon URL</a> remains null .)
260
273
261
- <li><p> Append <var> action</var> to <var> notification</var> 's list of <a >actions</a> .
274
+ <li><p> Append <var> action</var> to <var> notification</var> 's <a for=notification >actions</a> .
262
275
</ol>
263
276
264
277
<li><p> Return <var> notification</var> .
@@ -420,12 +433,12 @@ interpreted as a language tag. Validity or well-formedness are not enforced. [[!
420
433
421
434
<li>
422
435
<p> If the notification platform supports actions and action icons, then for each <var> action</var>
423
- in <var> notification</var> 's list of <a >actions</a> <a for=/>fetch </a> <var>action</var>' s
424
- <a for=action>icon URL </a> , if <a for=action>icon URL</a> is set .
436
+ in <var> notification</var> 's <a for=notification >actions</a>: if <a for=action>icon URL </a> is
437
+ non-null, <a for=/>fetch </a> <var> action </var> 's <a for=action>icon URL</a> .
425
438
426
439
<p class=note> The intent is to fetch this resource similar to an
427
440
<a href="https://html.spec.whatwg.org/multipage/images.html#update-the-image-data"><code><img></code></a> ,
428
- but this <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=24055 ">needs abstracting</a> .
441
+ but this <a href="https://github.com/whatwg/html/issues/4474 ">needs abstracting</a> .
429
442
430
443
<p> Then, <a>in parallel</a> :
431
444
@@ -435,9 +448,9 @@ interpreted as a language tag. Validity or well-formedness are not enforced. [[!
435
448
<li><p> If the <a for=/>response</a> 's <a>internal response</a>' s <a for=response>type</a> is
436
449
"<code> default</code> ", then attempt to decode the resource as image.
437
450
438
- <li><p> If the image format is supported, set <var> action</var> 's
439
- <a for=action>icon resource</a> to the decoded resource. (Otherwise
440
- <var> action </var> has no < a for=action>icon resource</a> .)
451
+ <li><p> If the image format is supported, then set <var> action</var> 's
452
+ <a for=action>icon resource</a> to the decoded resource. (Otherwise <var> action </var> 's
453
+ <a for=action>icon resource</a> remains null .)
441
454
</ol>
442
455
</li>
443
456
</ol>
@@ -509,10 +522,9 @@ interpreted as a language tag. Validity or well-formedness are not enforced. [[!
509
522
510
523
<h3 id=activating-a-notification>Activating a notification</h3>
511
524
512
- <p> When a <a>notification</a> <var> notification</var> ,
513
- or one of its <a>actions</a> , is activated by the user, assuming the underlying
514
- notification platform supports activation, the user agent must (unless otherwise
515
- specified) run these steps:
525
+ <p> When a <a>notification</a> <var> notification</var> , or one of its
526
+ <a for=notification>actions</a> , is activated by the user, assuming the underlying notification
527
+ platform supports activation, the user agent must (unless otherwise specified) run these steps:
516
528
517
529
<ol>
518
530
<li>
@@ -522,7 +534,7 @@ specified) run these steps:
522
534
<li><p> Let <var> action</var> be the empty string.
523
535
524
536
<li><p> If one of <var> notification</var> 's <a for=notification>actions</a> was activated by the
525
- user, then set <var> action</var> to that <a for=notification >action</a> 's <a for=action>name</a> .
537
+ user, then set <var> action</var> to that <a for=/ >action</a> 's <a for=action>name</a> .
526
538
527
539
<li> <a>Fire a service worker notification event</a> named "<code> notificationclick</code> " given
528
540
<var> notification</var> and <var> action</var> .
@@ -872,7 +884,7 @@ then return null.
872
884
<li><p> Let <var> frozenActions</var> be an empty list of type {{NotificationAction}} .
873
885
874
886
<li>
875
- <p> <a for=list>For each</a> <var> entry</var> of <a>this</a> 's <a>notification</a>' s list of
887
+ <p> <a for=list>For each</a> <var> entry</var> of <a>this</a> 's <a>notification</a>' s
876
888
<a for=notification>actions</a> :
877
889
878
890
<ol>
@@ -884,8 +896,9 @@ then return null.
884
896
<li><p> Set <var> action</var> ["{{NotificationAction/title}}"] to <var> entry</var> 's
885
897
<a for=action>title</a> .
886
898
887
- <li><p> Set <var> action</var> ["{{NotificationAction/icon}}"] <var> entry</var> 's
888
- <a for=action>icon URL</a> .
899
+ <li><p> If <var> entry</var> 's <a for=action>icon URL</a> is non-null, then set
900
+ <var> action</var> ["{{NotificationAction/icon}}"] to <var> entry</var> 's
901
+ <a for=action>icon URL</a> , <a lt="URL serializer">serialized</a> .
889
902
890
903
<!-- XXX IDL dictionaries are usually returned by value, so don't need to be
891
904
immutable. But FrozenArray reifies the dictionaries to mutable JS
@@ -922,11 +935,10 @@ not.onclick = function() { displaySong(this); };</pre>
922
935
<p> <a lt="persistent notification">Persistent notifications</a> fire
923
936
<code> notificationclick</code> events on the {{ServiceWorkerGlobalScope}} .
924
937
925
- <p> Here a service worker shows a notification with a single "Archive"
926
- <a lt="actions">action</a> , allowing users to perform this common task from the
927
- notification without having to open the website (for example the notification
928
- platform might show a button on the notification). The user can also activate
929
- the main body of the notification to open their inbox.
938
+ <p> Here a service worker shows a notification with a single "Archive" <a for=/>action</a> , allowing
939
+ users to perform this common task from the notification without having to open the website (for
940
+ example the, notification platform might show a button on the notification). The user can also
941
+ activate the main body of the notification to open their inbox.
930
942
931
943
<pre class=example id=example-50e7c86c>
932
944
self.registration.showNotification("New mail from Alice", {
0 commit comments