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

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

From: Travis Leithead <travil@windows.microsoft.com>
Date: Wed, 16 Apr 2008 11:50:27 -0700
To: Web API public <public-webapi@w3.org>, Doug Schepers <schepers@w3.org>
Message-ID: <0003CB8B8FE2154EB50431DB2B8F69C002C7A38D42@NA-EXMSG-W601.wingroup.windeploy.ntdev.microsoft.com>

Sending to the right list...

-----Original Message-----
From: Travis Leithead
Sent: Wednesday, April 09, 2008 1:02 PM
To: 'public-webapi-request@w3.org'; 'Doug Schepers'
Subject: [DOML3Events] Add success/failure boolean to add/removeEventListener?

I just wanted to send this request to the list to generate some discussion. Today, addEventListener and removeEventListener return 'void' (nothing). In other words, a web-dev cannot know if one of these methods succeeded or not.

Currently the only way for a script to check to see if these succeeded, is to do validation in the EventListener itself. (Fire the event programmatically, ensure that it was fired in the callback.)

The spec does mention that repeated adding of event listeners (with all the same params) is a no-op.

Admittedly, there are fewer use-cases for testing a return value from addEventListener, than there are for removeEventListener.

IE supports a return value from its proprietary attachEvent/detachEvent APIs.

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.

Received on Wednesday, 16 April 2008 18:51:00 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:26 UTC