W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2014

[whatwg] hit regions: event bubbling

From: Rik Cabanier <cabanier@gmail.com>
Date: Fri, 28 Feb 2014 18:54:30 -0800
Message-ID: <CAGN7qDBZry2is=PHMPBYZMGm=HssVhU79uh59sdL+iWdhFKNbQ@mail.gmail.com>
To: "whatwg@whatwg.org" <whatwg@whatwg.org>
Reading the hit region spec [1] on event handling, I was wondering how
event bubbling is supposed to be handled.
Let's say you have the following markup:

<canvas id="cnv">

<a id="a" href="..."></a>

<a id="b" href="..."></a>

</canvas>


and the following code:

var ctx = document.getElementById("cnv").getContext("2d");

var a = document.getElementById("a");

a.addEventListener("click", function(){...});

var b = document.getElementById("b");

// draw region for a

ctx.addHitRegion({control: a, id: "a"});

// draw region for b

ctx.addHitRegion({control: b, parentID: "a"});

Now, if there's a mouse click for control b, should the event be handled by
the handler for control a?

Also, should event from the fallback content bubble out of the canvas
element or should it act as a barrier?

1:
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#hit-regions
Received on Saturday, 1 March 2014 02:54:58 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:17 UTC