The SVG specification describes how events such as mouse events are handled here: http://www.w3.org/TR/SVG/interact.html#PointerEvents.

In summary, when a mouse event occurs over the graphical rendering of a document, one element in the document is chosen as the recipient of the event. How this event is chosen is described in the link above, but briefly it is the "top most" (i.e., latest in the document) element whose rendering appears under the mouse position. For elements that draw paths, it is possible to configure the element to receive events over only the path, or only the interior of the path, or both.

The event then takes a round trip journey from the top of the document down successive child nodes to the chosen element (in the "capture" phase), then returns via the same path in reverse back up to the top node (in the "bubble" phase). Various properties (such as pointer-events) on the nodes visited can change whether the event propagation is intercepted or passed on to the next node.

In the case of <use> elements, for the purpose of event propagation, the referenced subtree is cloned at the point of its reference. This means that the ancestors of the <use> element are traversed, not the ancestors of the target of the <use>, even though the latter nodes are the ones actually used for the rendering of the graphics.

EventHandling (last edited 2009-09-20 23:47:43 by localhost)