[proximity] HTML's WebIDL Function

I think the proximity spec should drop the use of HTML's Function callback in favour of DOM4's EventListener [1] callback interface (cc'ing Anne for guidance also).  

The problem with HTML's Function definition is that it's not fully "Web compatible" because it does not take into consideration objects that contain a handleEvent attribute (at least that is my understanding).

In other words, the following results in onuserproximity becoming "null" in our current specification:  

window.onuserproximity = {handleEvent: function(e){…}}

While on other event handlers idl attributes (e.g., onload, onclick, etc.), the following works just fine:

window.onload = {handleEvent: function(e){console.log(e)}}
window.onclick = {handleEvent: function(e){console.log(e)}}

var x = [];   
x["handleEvent"] = function(e){console.log(e)}
window.onclick = x;  


For legacy reasons, DOM4's EventListener callback caters for the above. For the sake of consistency with other event handler attributes, the proximity spec should behave the same.    

See the following to see legacy behaviour in action:
http://jsfiddle.net/marcosc/ZVBQk/1/

[1] http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#eventlistener
[2] http://dev.w3.org/2006/webapi/WebIDL/#dfn-callback-interface
--  
Marcos Caceres
http://datadriven.com.au

Received on Monday, 28 May 2012 11:26:17 UTC