[Bug 22757] "If listener's callback is a Function object, it..."

https://www.w3.org/Bugs/Public/show_bug.cgi?id=22757

--- Comment #5 from Boris Zbarsky <bzbarsky@mit.edu> ---
I don't think I was making any assumptions, just making a statement about the
spec in question....

> As for invoking the callback, it's done in http://dom.spec.whatwg.org/#concept-
> event-listener-invoke (4.7 at the moment).

My point is, that text is wrong if you mean to actually invoke the callback the
way it should be invoked.

> I kinda thought IDL would handle the Function/handleEvent distinction. I guess
> not.

It does.  Calling the handleEvent operation of the EventListener interface,
with the "callback this value" set to the event's currentTarget, will do the
right thing per WebIDL.  See
http://dev.w3.org/2006/webapi/WebIDL/#es-user-objects the list of steps for
what happens when an operation of a callback interface is called, with
particular attention to step 2 and step 5, which transparently handle the case
when the underlying JS object happens to be a Function object.

So from the DOM point of view an EventListener is just an IDL object with a
handleEvent operation, which the DOM spec should be calling, with the right
"callback this value".  Then WebIDL takes care of the rest.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 23 July 2013 04:32:38 UTC