News for hackers. Stuff that matters.
Re:Always return on events is faster, but why? by bengillies on Friday October 18, 2013 @06:03AM (#6570580)
right. undefined is falsy, but it's quite different to false (i.e. undefined !== false)
Re:Always return on events is faster, but why? by lucideer on Friday October 18, 2013 @07:00AM (#6570718)
true, but a boolean return value is expected for event listener callbacks.
Re:Always return on events is faster, but why? by Stratoscope on Friday October 18, 2013 @12:54PM (#6572398)
That's not quite how it works. jQuery checks specifically for false with an === comparison. It doesn't do anything like a !! on the return value to convert it to boolean true or false. It only calls stopPropagation and preventDefault when the return value is false, not just any falsy value.

I posted the jQuery code in a previous comment; take a look at that and you can see how it works.