Re: About the propagation of events across documents

Le 03/08/2011 07:19, Cameron McCormack a écrit :
> Hi Cyril.
>
> On 2/08/11 1:39 AM, Cyril Concolato wrote:
>> I'm looking for the spec/chapter that the describes the behavior of
>> events in case of nested documents. More precisely, I'm interested in
>> the behavior of key events when they are not processed by a sub
>> document? Should they be forwarded to the parent document? Does it
>> depend on the referencing element (<animation>, <foreignObject> ...)? I
>> remember some discussion in the past about this problem for mouse
>> events, but I can't find the resolution/clarification. Can someone help?
>
> It would depend on the way the inner SVG document is referenced. For <object>, the event would not propagate out. If it was inline, then it would. I imagine that DOM Events (or the new DOM Core) defines the exact propagation for events within a Document, and that it is defined to stop propagating once it reaches the Window object. When you have inline content, you are just propagating normally up the document.
Thanks Cameron for your reply. I understand that typically events don't propagate across documents (i.e. when the sub-document is referenced, not inline). The issue is probably that events carry document related values (e.g. the target element ...). But there are cases where a pseudo-propagation happens and is useful.

Take the example of a mouse click. If you click on a rectangle in the sub-document, this latter document will get the event and will not propagate it to the parent document. But if you click on the transparent background of the sub-document and there happen to be a circle from the main document behind it, the main document will process the event (assuming pointer-events is set properly). Correct?

Then consider the case of a Key event. The sub-document is focused and receives the key events. In some cases, you might want that the key events not consumed at sub-document level are processed at the parent document level. You probably could do this by calling from the sub-document a method on the window.parent object, but you don't want your sub-document to know how the parent document is made. Do you get my point? I'm wondering if this behavior is specified somewhere (some key-events property like the pointer-events one).

Cyril
-- 
Cyril Concolato
Maître de Conférences/Associate Professor
Groupe Multimedia/Multimedia Group
Telecom ParisTech
46 rue Barrault
75 013 Paris, France
http://concolato.wp.institut-telecom.fr/

Received on Wednesday, 3 August 2011 08:32:58 UTC