I was not aware that returning false (or anything else for that matter) from an event handling callback would do anything, but it sounds like doing so invokes both event.preventDefault() and event.stopPropagation() ... is that correct? If so, then a stop() method certainly does seem unnecessary.
One other question: don't all JS functions return false by default (or rather, return nothing, which then gets coerced to false)? If so, wouldn't that make it so that every event handler you hook up automatically stops/prevents, unless you tell it to return something? Jeremy On Nov 25, 3:45 pm, Karl Swedberg <[EMAIL PROTECTED]> wrote: > Two things come to mind: > > 1. jQuery also has a stop() method that is used to halt animations in > progress, so the name is probably not such a good > idea:http://docs.jquery.com/Effects/stop > > 2. it's already very easy to add return false; after doSomething() . > Wouldn't that effectively do the same thing as your stop()? > > --Karl > > ____________ > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > On Nov 25, 2008, at 5:36 PM, machineghost wrote: > > > > > As a former MochiKit user I'm continually impressed by how well jQuery > > does everything that MochiKit can do, only better. However, there is > > one very minor convenience feature that MochiKit had that I miss: in > > Mochikit's abstracted event object (ie. the thing your event handling > > callbacks receive as an argument) there is a method, in addition to > > preventDefault and stopPropagation, called simply "stop". All this > > method does is invoke those two other methods, so it would be super- > > easy to add it to jQuery. If we did, it would turn code like this: > > > function someCallback(event) { > > event.stopPropagation(); > > event.preventDefault(); > > doSomething(); > > } > > > in to this: > > > function someCallback(event) { > > event.stop(); > > doSomething(); > > } > > > which (to me at least) seems a lot cleaner. > > > So ... what can I do to make this happen? Who decides whether > > something like this gets added, and what can I do to convince them > > that it's worth adding? > > > Thanks in advance for any feedback. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" 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/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
