Should events be preferably sent to the Window or the nearest object?

Hi,

I would love to gather the opinion of public-webapps on a discussion
Hixie and I had for two different APIs recently: if an array |foo| can
change, should the change event be fired on its parent or the window
(its grandparent)? The two cases we discussed with Hixie were
navigator.languages and screen.orientation for which Hixie thinks the
change events should be fired on the window so developers can do <body
onlanguagechange="..." onorientationchange="..."> but I feel that having
the change event sent on the parent would make things more
self-contained.

I would love to hear people's opinion on this.

(Note: sending an orientationchange event to the window object would
have other implications because there is a proprietary API that does
that but this is entirely orthogonal.)

Thanks,
-- Mounir

Received on Thursday, 20 March 2014 15:21:01 UTC