baseprime / grapnel

The smallest JavaScript router with named parameters, HTML5 pushState, and middleware support
http://grapnel.js.org
468 stars 40 forks source link

event.stopPropagation() only stops next route, not any further routes after that #23

Closed rj33 closed 9 years ago

rj33 commented 9 years ago

It seems stopPropagation only stops the next route, at least that seems to be what it was doing for me. I'm not sure if this is the best way to solve the issue, but this worked for me: changing


                if(event.parent() && event.parent().propagateEvent === false) return self;

to

                if(event.parent() && event.parent().propagateEvent === false) {
                    event.propagateEvent = false;
                    return self;
                }

Which means next time we jump to the third route the parent will now have the propagate set to false, and the subsequent handler will also be prevented.

baseprime commented 9 years ago

Landed in 0.5.3