[whatwg] hit regions: event bubbling

Rik Cabanier cabanier at gmail.com
Fri Feb 28 18:54:30 PST 2014

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>


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?


More information about the whatwg mailing list