W3C home > Mailing lists > Public > public-webapi@w3.org > April 2008

Re: [DOML3Events] Add success/failure boolean to add/removeEventListener?

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Wed, 16 Apr 2008 21:02:06 +0200
To: Travis Leithead <travil@windows.microsoft.com>
Cc: Web API public <public-webapi@w3.org>
Message-ID: <0pic04l4ghpaor8argdn3tru0q9vv0qtkg@hive.bjoern.hoehrmann.de>

* Travis Leithead wrote:
>Today, addEventListener and removeEventListener return 'void' (nothing).
>In other words, a web-dev cannot know if one of these methods succeeded
>or not.

If they fail (e.g., an implementation may have a maximum number of
listeners per event target and adding it would exceed the limit), the
expectation is that some implementation-defined exception is thrown.

So the methods either throw or succeed, after addEventListener the
listener will have been added, and after removeEventListener the event
listener will not be registered.

The call may have no effect because the listener has already been
registered, or was not registered, respectively, but that would not be
a failure. Knowing about this may be interesting for debugging, but
it seems this would be better addressed by debug traces than return

>Back compat in scripts is not an issue since these API's never returned
>a value before--thus scripts will not be checking for return values.

This is only true for some language bindings, for others changing the
return value would create, among others, binary compatibility problems.
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Wednesday, 16 April 2008 19:02:46 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:10:00 UTC