[Laszlo-dev] "can't use lz.embed.attachEventHandler" Why?

Max Carlson max at openlaszlo.org
Thu Jun 18 11:58:32 PDT 2009


When I wrote that comment, I was under the impression that 
event.preventDefault() didn't work reliably in all browsers. 
Apparently, M$ has and event.returnValue property which does the same 
thing when set to false.

So, I used the idiom of returning false to prevent the default behavior, 
which can only be done by directly assigning a function to an event 
handler.  It's old skool, but it works everywhere!

See http://www.quirksmode.org/js/events_early.html for more details.

P T Withington wrote:
> On 2009-06-17, at 21:10EDT, hqm at openlaszlo.org wrote:
> 
>> +// can't use lz.embed.attachEventHandler because we need to cancel 
>> events
> 
> Can someone explain this comment to me?  I see it in a number of places, 
> and it worries me.  I'm concerned that we are using the "assign event 
> handler as property" interface, because of the possibility that more 
> than one place in the code will try to assign to the same event and end 
> up losing.  I thought attaching event handlers supported both cancelling 
> bubbling and default suppression, so I don't understand the comment.
> 
> Please enlighten me.

-- 
Regards,
Max Carlson
OpenLaszlo.org


More information about the Laszlo-dev mailing list