Hi Cameron - here is the feedback you provided to me re Web IDL comments LC-95 
and LC-98 <http://dev.w3.org/2006/webapi/WebIDL/lc3.txt>.

[[
LC-95 relates to providing built-in support to the Web IDL language for a 
common construct that will be used for event listener attributes in a variety 
of specifications.  At the time of the bug being raised, event listener 
attributes had to be written like

 callback Function = any (Event event);
 [TreatNonCallableAsNull] attribute Function? onclick;
 [TreatNonCallableAsNull] attribute Function? onmousedown;
 [TreatNonCallableAsNull] attribute Function? onmouseup;

Ms2ger's argument was that because [TreatNonCallableAsNull] Function? and 
callbacks in general were to be used just for  event listener attributes, it 
would be better to add this as built-in functionality, such as

 attribute eventhandler onclick;
 attribute eventhandler onmousedown;
 attribute eventhandler onmouseup;

My argument was that callbacks should be used for things other than event 
listener attributes (the fundamental disagreement of LC-98), and that building 
in the concept of event handlers to Web IDL seemed like a layering violation.  
My compromise solution was to allow [TreatNonCallableAsNull] to be specified on 
a callback, to suggest a callback to be defined in either DOM or HTML, to 
reduce the amount of IDL needed:

 /* in either the DOM or HTML spec */
 [TreatNonCallableAsNull] callback EventHandler = any (Event event);

 /* in specs defining event handler attributes */
 attribute EventHandler onclick;
 attribute EventHandler onmousedown;
 attribute EventHandler onmouseup;

This seemed concise enough to me.  As yet Ms2ger has not indicated whether this 
compromise solution is acceptable.

The mail where I proposed this solution is:

 http://www.w3.org/mid/[email protected]


LC-98 relates to whether IDL callbacks should be used for anything other than 
event listener attributes.  There was a sizable disagreement in what we should 
recommend for other specifications wrt callbacks and whether objects like ({ 
handleEvent: function() { ... } }) in JS should be considered valid callbacks 
in general or just for DOM Events' addEventListener/removeEventListener.  That 
was discussed in this thread:

 http://www.w3.org/mid/[email protected]

Jonas Sicking and Olli Pettay from Mozilla were the main proponents of allowing 
the object-with-property form as a callback in all APIs, whereas others argued 
for allowing object-with-property just for the DOM Events case because Web 
content relies on that.  I attempted to make a reasoned decision here:

 http://www.w3.org/mid/[email protected]

Although Ms2ger did not participate in the thread, he raised the LC-98 bug to 
add a warning to Web IDL against using callbacks for anything other than the 
DOM Events case, which would effectively route around the decision I made in 
the thread.  Since it was inconsistent with that decision, I declined to make 
the suggested change.  I asked Ms2ger to respond on that thread with arguments 
against my analysis but so far no arguments have been forthcoming.
]]

-AB


Reply via email to