Open GoogleCodeExporter opened 9 years ago
No, as odd as it may seem, returning something "truthy" is how you cancel the
default behavior. This is consistent with other API and add-on callbacks.
These
aren't listeners, so I didn't feel I needed to follow listener conventions.
The
default behavior follows through if you return nothing (or false of course).
Think
of the return value for callbacks as indicating that your code has handled the
situation on its own or not (as opposed to whether it wants to cancel or not).
It is early enough in the game to change it (and there aren't a lot of places
that
have such callbacks), but I think documenting the callback interface will clear
up
any confusion. I'm open to suggestions though.
Original comment by dmark.ci...@gmail.com
on 30 Mar 2010 at 4:39
Hm, I see. It sounds counter-intuitive to me, and I'm guessing that it will for
most
of the newcomers. The main reason is exactly how DOM0 listeners handle it, I
think
that following their conventions would be the less surprising behavior at first
glance.
Original comment by gabrielg...@gmail.com
on 30 Mar 2010 at 4:48
Yes, the return true convention for callback behavior overriding the default is
something I've used since back in my days as a Windows application developer
(where
such practice was more prevalent), but I agree that it would be better to
switch it
for the release. I'll have to review where I am doing this (alert add-on comes
to
mind) and I don't think it is in a lot of places.
Original comment by dmark.ci...@gmail.com
on 30 Mar 2010 at 5:09
For now I'll use the current convention then.
Thanks, David.
Original comment by gabrielg...@gmail.com
on 30 Mar 2010 at 5:26
Original comment by dmark.ci...@gmail.com
on 30 Mar 2010 at 5:53
Original comment by dmark.ci...@gmail.com
on 13 May 2010 at 9:41
Original issue reported on code.google.com by
gabrielg...@gmail.com
on 30 Mar 2010 at 3:12Attachments: