- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Thu, 10 Apr 2008 02:23:01 -0500
- To: Ian Hickson <ian@hixie.ch>
- CC: "public-html@w3.org" <public-html@w3.org>
Ian Hickson wrote: > I've made that clearer. Please let me know if it's clear enough. Looks reasonable, thanks. > Yeah... the idea is that in JS the only way to provide an EventListener is > to provide a Function. That's not necessarily true, though... > This is still a somewhat vaguely defined area, I'm > mostly waiting for the DOM Bindings spec to stabilise so that I can define > this more tightly. OK. >> For example, in some UAs it's possible to assign a String to >> document.body.onclick, and it won't affect the click handlers for the >> body... I'm not sure how much compat there is across UAs here. > > Not sure what you mean here. document.body.onclick = 'alert("test")'; In Gecko (1.8 and 1.9), this sets document.body.onlick to the string 'alert("test")'. No event handler is added for the click event, as far as I can tell. In Opera 9.25, this sets document.body.onclick to a Function object which decompiles to: function(event) { alert("test"); } This Function object is then treated as would any Function object assigned to document.body.onclick. In Safari 3.1, this sets document.body.onclick to null, as far as I can tell. I don't have IE on hand to test, unfortunately. Given the above, I'd almost lay money on it doing something none of those three UAs do. ;) Clearly, interoperability here is ... somewhat lacking. None of those three results are what I'd expect given the IDL, though. I'd expect an exception when the String literal cannot be converted to an EventListener. I'm not even sure what the right thing to specify here is, much less what the right way to express it in IDL is, to be honest. -Boris
Received on Thursday, 10 April 2008 07:24:28 UTC