- From: Anssi Kostiainen <anssi.kostiainen@nokia.com>
- Date: Mon, 20 Jun 2011 14:24:19 +0300
- To: public-device-apis WG <public-device-apis@w3.org>, ext Doug Turner <doug.turner@gmail.com>
Hi, [I'd like to make sure this important issue Doug pointed out does not go unnoticed, so I'd like to elaborate it a bit.] On 16.6.2011, at 15.50, ext Anssi Kostiainen wrote: > On 15.6.2011, at 19.48, ext Doug Turner wrote: > >> There are a few concerns/ideas I have about the Battery API. >> >> 1) I do not think we want handlers to hang off of the window object. >> >> window.onbatterystatus is bad. we have addEventHandler() > > I notice the Device Orientation Event only exposes itself via window.addEventListener(), while e.g. the online and offline events also have document.ononline and document.onoffline handlers (mirrored also on document.body) as well as corresponding attributes on the <body>. But there's nothing on window. So perhaps window.onbatterystatus should not be there in the global namespace. Actually, it appears that as per the HTML5 spec [1] ononline/onoffline event handlers should be supported also by Window objects, but implementations do not seem to do that currently (e.g. see this test case at [2]). I found some old -- but IMHO still relevant and interesting -- discussion from the Mozilla Bugzilla at [3,4]. The short summary is the window.ononline/offline was in, but has since been removed. > How do others feel about that? My personal take on this is we should pave the cowpaths if any. This feature should work in a way which is the most consistent with other similar features. As said, we have the Device Orientation and online/offline events, but both expose themselves differently. In addition to those we have a bunch of other event handlers (some legacy, some new) [1] which hang off of the window such as onmessage, onstorage etc. I'd prefer to go to LC with the current spec and gather more implementers' feedback and adjust the spec accordingly when we have running code around. WebKit implementation can be tracked at [5], and there's a related thread on webkit-dev ML at [6]. Doug - Are you planning to hack something around this? Would be cool to get you guys on board as well in addition to WebKitters :) -Anssi [1] http://dev.w3.org/html5/spec/webappapis.html#event-handlers-on-elements-document-objects-and-window-objects [2] http://html5demos.com/offline-events [3] https://bugzilla.mozilla.org/show_bug.cgi?id=336359 [4] https://bugzilla.mozilla.org/show_bug.cgi?id=380618 [5] https://bugs.webkit.org/show_bug.cgi?id=62698 [6] https://lists.webkit.org/pipermail/webkit-dev/2011-June/017120.html
Received on Monday, 20 June 2011 11:21:58 UTC