W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2011

Re: 4.4 Dispatching events and "participating in a tree"

From: Olli Pettay <Olli.Pettay@helsinki.fi>
Date: Tue, 05 Jul 2011 00:29:55 +0300
Message-ID: <4E1230D3.20200@helsinki.fi>
To: David Flanagan <dflanagan@mozilla.com>
CC: www-dom@w3.org
On 07/05/2011 12:14 AM, David Flanagan wrote:
> The "dispatch an event" algorithm branches depending on whether the
> event target is "participating in a tree". At first, I was thinking
> about nodes only and assumed this test was checking whether parentNode
> was null or not, since capturing and bubbling don't make sense for nodes
> that have no parent. But the definition of "participating in a tree"
> just says that the object has a parent (even if it is null) and
> children....
>
> Does the language really need to be this general? Are events ever
> dispatched on trees that are not document trees?
Yes. See for example IndexedDB.


> I don't think that
> events ever bubble up a tree of frames, do they?
Frames? You mean iframe/frame elements? Events don't propagate
(bubble is just one phase in event propagation) in that case,
except in Gecko chrome/content boundary, but that is not visible to
the web pages.


>
> So couldn't the algorithm branch based on whether target is a Node and
> parentNode is non-null instead of the vaguer and more confusing
> "participating in a tree" test?
>
> And here's a related question... I've never tried registering a
> capturing event handler on a non-Node event target like an XHR. Such an
> event handler could never be invoked, though.
Capturing event listeners do fire @target phase.
(Not per DOM 2 Events, but per implementations, and per DOM 3 Events)



> So should the
> addEventListener() method include the "participates in a tree" test and
> throw an exception if the 3rd argument is true?
No.




-Olli



>
> David
>
>
Received on Monday, 4 July 2011 21:30:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:14:08 GMT