- From: Arthur Barstow <art.barstow@nokia.com>
- Date: Mon, 2 Apr 2012 09:31:34 -0400
- To: Cameron McCormack <cam@mcc.id.au>
- Cc: www-archive <www-archive@w3.org>
- Message-Id: <6819D54E-B56B-471B-A97E-D796909FC79C@nokia.com>
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/4F5D42E7.4080705@mcc.id.au 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/op.v4mwt9vv64w2qv@annevk-macbookpro.local 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/4EEAB5AD.5080705@mcc.id.au 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
Received on Monday, 2 April 2012 13:32:10 UTC