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

Max Carlson max at laszlosystems.com
Thu Jun 18 13:01:33 PDT 2009


Agreed. 

-----Original Message-----
From: P T Withington <ptw at pobox.com>
Sent: Thursday, June 18, 2009 12:06 PM
To: Max Carlson <max at openlaszlo.org>
Cc: Henry Q Minsky <hminsky at laszlosystems.com>; Laszlo-dev bug reporting <laszlo-dev at openlaszlo.org>
Subject: Re: "can't use lz.embed.attachEventHandler" Why?

But there is the limitation that each handler you install this way  
removes any other handlers that might want to listen for the event.   
That's the part that worries me.  If there is a way to do the same  
thing with attachEvent, we ought to fix these, IMO.

On 2009-06-18, at 14:58EDT, Max Carlson wrote:

> 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