I'd argue that it's a better pattern to have a handler method that calls the
other method. It's more transparent that this is what it's doing than adding
a lambda function that returns false. By adding a 'click' event that returns
false, you're going to stop the click event even if you later remove your
click handler. I'd rather see:
click: function(e) {
e.stop();
this.foo();
},
foo: function...
than
el.addEvent('click', this.foo.bind(this)).addEvent('click', $lambda(false));
The former is much more understandable and maintainable. Not to mention
extensible.
On Wed, Apr 22, 2009 at 9:16 AM, Sanford Whiteman [Mobile] (via Nabble) <
[email protected]<ml-user%[email protected]>
> wrote:
>
> > why is typing "return false" so much work?
>
> It's definitely not if you have control over the bound method, but I
> think the OP is going for a way of deadening the final default action
> when the bound method can't/shouldn't be altered, and without wrapping
> it in another method....
>
> --Sandy
>
>
>
> ------------------------------
> View message @
> http://n2.nabble.com/-Moo--Return-false-function-tp2669929p2677177.html
> To start a new topic under MooTools Users, email
> [email protected]<ml-node%[email protected]>
> To unsubscribe from MooTools Users, click here< (link removed) >.
>
>
>
-----
The MooTools Tutorial: http://www.mootorial.com www.mootorial.com
Clientcide: http://www.clientcide.com www.clientcide.com
--
View this message in context:
http://n2.nabble.com/-Moo--Return-false-function-tp2669929p2677422.html
Sent from the MooTools Users mailing list archive at Nabble.com.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MooTools Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/mootools-users?hl=en
-~----------~----~----~----~------~----~------~--~---