Wouldn't stopPropagation() do the trick?