- From: Alex Russell <slightlyoff@google.com>
- Date: Fri, 24 Apr 2009 14:31:52 -0700
- To: public-webapps@w3.org
>From this thread on whatwg: http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-April/019379.html and per Hixie's request that I re-direct this particular discussion here: http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-April/019381.html The DOM function "addEventListener" is probably too long. It should, instead, be named something much shorter owing to the amount of exercise it receives. Further, it should default the last parameter to be "false" (non-capture-phase). This call: node.addEventListener("click", function(e) { /* ... */ }, false); Should be able to be written as (e.g.): node.listen("click", function(e) { /* ... */ }); Similarly, "removeEventListener" should be aliased as "unlisten". As a further help, the common-case operation of listening-for-a-single-call is currently written as: var h = function(e) { /* .... */ node.removeEventListener(h); }; node.addEventListener("click", h); And given how common this operation it, it should probably have an alias: node.listenOnce("click", function(e) { /* ... */ }); Regards
Received on Friday, 24 April 2009 21:32:32 UTC