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

How to get event listener method inheritance clarified

From: Christopher M. Balz <christophermbalz@stanfordalumni.org>
Date: Thu, 17 Sep 2009 16:02:35 -0700 (PDT)
Message-ID: <726421.5863.qm@web30808.mail.mud.yahoo.com>
To: www-dom@w3.org
Imho, the DOM spec should clearly state where the 'addEventListener' and 'removeEventListener' methods should be located in the 'Element' inheritance hierarchy.

Allowing easy wrapping/extension of these methods is critical to current frameworks.  An example is JavaScript frameworks that want to make these methods accept an object-context argument - a 'this' context for the event listener to run in.  That enables object-oriented event listening.

Currently, Web browsers based on WebKit JavaScript glue have these methods  at the top of the hierarchy, with no overriding implementations in subclasses such as 'HTMLDivElement'. As there are many such subclasses, and even varying sets of such subclasses, that arrangement allows for fast (e.g. fast Web page load) and effective (covering all subclasses of 'Element') extension of these methods to meet modern software engineering standards for programming-in-the-large.

However the other browsers do not currently follow suit.  Because the DOM spec defines many items that inherit from 'Element', it should specify the inheritance characteristic of these methods.

Could this be included in a spec update?  

Thank you,

  Christopher M Balz 
Received on Friday, 18 September 2009 06:47:28 GMT

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