Re: [whatwg] Notification's click event should be cancelable

On Tue, Aug 26, 2014 at 12:15 AM, Anne van Kesteren <annevk@annevk.nl> wrote:
> On Mon, Aug 25, 2014 at 6:42 PM, Jonas Sicking <jonas@sicking.cc> wrote:
>> I definitely think we need the ability for code running in Windows
>> (i.e. code that handles UI) to be able to enumerate any notifications
>> created by the website.
>
> Fair, but maybe those "copy objects" should not get events.

I don't see a problem with firing events on all Notification
instances, and only changing focus if none of the events were
cancelled.

After all, we do something very similar when firing events on a Node.
Then too multiple EventTargets have their event handlers called, and
only if none of the event handlers, on any of the EventTargets, cancel
the event do we take the default action.

Granted, in those cases we use the same Event instance, and it's part
of a single event dispatch. But that difference is pretty small from
the webpage point of view. The main difference is that
.defaultPrevented reflect cancellation, but worst come to worst we
could make that work here too.

> We could
> make a division between notification records and notification objects.
> And we could even go as far as only offer notification records for
> notifications associated with a service worker.

I don't really understand this.

/ Jonas

Received on Tuesday, 26 August 2014 09:06:59 UTC