From d7f3e1a5ba09006aafa310608ac7e7a096b2190a Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Thu, 7 Nov 2024 15:52:01 +0100 Subject: [PATCH] Editorial: rename action to notification action and export it Also export a notification's actions. This is needed for Declarative Web Push. --- notifications.bs | 74 +++++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/notifications.bs b/notifications.bs index 0d475a3..36bc8f5 100644 --- a/notifications.bs +++ b/notifications.bs @@ -125,21 +125,22 @@ initially « ». is not otherwise accessible to the end user, especially since notification platforms that do not support these features might ignore them. -

A notification has associated actions (a -list of zero or more actions). An action represents a choice -for an end user. Each action has an associated: +

A notification has associated actions +(a list of zero or more notification actions). A +notification action represents a choice for an end user. Each +notification action has an associated:

-
name +
name
A string. -
title +
title
A string. -
icon URL +
icon URL
Null or a URL. It is initially null. -
icon resource +
icon resource
Null or a resource. It is initially null.
@@ -151,11 +152,11 @@ or more, within the constraints of the notification platform. that any action an end user can invoke from a notification is also available within the web application. -

Some platforms might modify an icon resource to better -match the platform's visual style before displaying it to the end user, for example by rounding the -corners or painting it in a specific color. Developers are encouraged to use an icon that handles -such cases gracefully and does not lose important information through, e.g., loss of color or -clipped corners. +

Some platforms might modify an +icon resource to better match the platform's visual style before +displaying it to the end user, for example by rounding the corners or painting it in a specific +color. Developers are encouraged to use an icon that handles such cases gracefully and does not lose +important information through, e.g., loss of color or clipped corners.

A non-persistent notification is a notification whose service worker registration is null. @@ -261,18 +262,18 @@ clipped corners. maximum number of actions supported (skip any excess entries):

    -
  1. Let action be a new action. +

  2. Let action be a new notification action. -

  3. Set action's name to +

  4. Set action's name to entry["{{NotificationAction/action}}"]. -

  5. Set action's title to +

  6. Set action's title to entry["{{NotificationAction/title}}"].

  7. If entry["{{NotificationAction/icon}}"] exists, then parse it using baseURL, and if that does not return failure, - set action's icon URL to the return value. (Otherwise - action's icon URL remains null.) + set action's icon URL to the return value. (Otherwise + action's icon URL remains null.)

  8. Append action to notification's actions.

@@ -334,13 +335,13 @@ section of HTML. [[!HTML]]

User agents are expected to honor the Unicode semantics of the text of a notification's title, body, and the -title of each of its actions. Each is expected -to be treated as an independent set of one or more bidirectional algorithm +title of each of its actions. Each is +expected to be treated as an independent set of one or more bidirectional algorithm paragraphs when displayed, as defined by the bidirectional algorithm's rules P1, P2, and P3, including, for instance, supporting the paragraph-breaking behavior of U+000A LINE FEED (LF) characters. For each paragraph of the title, body and the -title of each of the actions, the +title of each of the actions, the notification's direction provides the higher-level override of rules P2 and P3 if it has a value other than "auto". [[!BIDI]] @@ -439,8 +440,9 @@ interpreted as a language tag. Validity or well-formedness are not enforced. [[!

  • If the notification platform supports actions and action icons, then for each action - in notification's actions: if icon URL is - non-null, fetch action's icon URL. + in notification's actions: if + icon URL is non-null, fetch action's + icon URL.

    The intent is to fetch this resource similar to an <img>, @@ -455,8 +457,8 @@ interpreted as a language tag. Validity or well-formedness are not enforced. [[! "default", then attempt to decode the resource as image.

  • If the image format is supported, then set action's - icon resource to the decoded resource. (Otherwise action's - icon resource remains null.) + icon resource to the decoded resource. (Otherwise + action's icon resource remains null.)

  • @@ -476,8 +478,8 @@ interpreted as a language tag. Validity or well-formedness are not enforced. [[!
  • Wait for any fetches to complete and notification's image resource, icon resource, and badge resource to be set (if any), as well as the - icon resources for the notification's actions - (if any). + icon resources for the notification's + actions (if any).

  • Let shown be false. @@ -546,7 +548,8 @@ platform supports activation, the user agent must (unless otherwise specified) r

  • Let action be the empty string.

  • If one of notification's actions was activated by the - user, then set action to that action's name. + user, then set action to that notification action's + name.

  • Fire a service worker notification event named "notificationclick" given notification and action. @@ -917,14 +920,14 @@ then return null.
  • Let action be a new {{NotificationAction}}.

  • Set action["{{NotificationAction/action}}"] to entry's - name. + name.

  • Set action["{{NotificationAction/title}}"] to entry's - title. + title. -

  • If entry's icon URL is non-null, then set +

  • If entry's icon URL is non-null, then set action["{{NotificationAction/icon}}"] to entry's - icon URL, serialized. + icon URL, serialized.