Re: Passing JavaScript Function object to EventTarget.addEventListener()

Henry <[email protected]>
Newsgroups gmane.comp.mozilla.devel.dom
Organization http://groups.google.com
Message-ID <1ba6fd42-dc42-4de5-898f-cb3a99e81b7e@w35g2000yqm.googlegroups.com>
On Dec 1, 1:16 pm, Sergey Yanovich wrote:
> [1] specifies that the second argument taken by
> addEventListener to be an EventListener instance. However,
> Mozilla accepts plain Function objects just fine.

From "ECMAScript Language Binding" (DOM Level 2 events):-

| Object EventListener
|    This is an ECMAScript function reference. This method has
|    no return value. The parameter is a Event object.

<URL: http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/ecma-script-binding.html
>

- so for ECMAScript the DOM level 2 events - EventListener - interface
is a ("plain") function object.

> Could anyone provide any pointers why this works (is this a DOM
> feature or an extension),

The behaviour is as specified (and expecting a Java-style -
EventListener - to be effective in cross-browser client-side code is
unrealistic, that would be an 'extension').

> and in which module this is implemented (dom, content,
> or xpconnect maybe)?

I have no idea.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.