[Bindings] extended attribute for callback function interfaces?

There are a number of interfaces, used as callbacks, like
EventListener [1], NodeFilter [2], and UserDataHandler [3], and
XPathNSEventResolver [4] where an interface has a single method and
is intended to be implemented by the DOM user as a callback.  In
ECMAScript bindings, the implementation typically accepts a raw
function for such cases, in addition to (or rather than, in some
implementations, perhaps?) an object with a named property for the
function.

Should there be an extended attribute to indicate such interfaces?
(I'd note that Mozilla's IDL has such an extended attribute,
[function].)

(I believe Mozilla will also accept { handleEvent: my_handler } as
an EventListener in addition to my_handler, where my_handler is a
function, but I'm not sure whether that's true of other
implementations.  It would probably be good if the relevant
specifications said one way or the other.)

-David

[1] http://www.w3.org/TR/DOM-Level-3-Events/events.html#Events-EventListener
[2] http://www.w3.org/TR/DOM-Level-2-Traversal-Range/traversal.html#Traversal-NodeFilter
[3] http://www.w3.org/TR/DOM-Level-3-Core/core.html#UserDataHandler
[4] http://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathNSResolver

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/

Received on Thursday, 18 October 2007 01:31:05 UTC