mbostock/d3 — pull request #1175 by tillberg (2013-03-29 23:51:37+00:00)
Title: Fix for #1005 - fix click suppression after dragend in cases where click doesn't fire.

Fixes Issue #1005 for both behavior.zoom and behavior.drag

This fixes (which we're using at appneta to fix this issue in our app for both zoom and drag) cases when code intended to suppress superfluous click events on dragend causes a later click (anywhere on the page) to be absorbed.

Since the undesired click event should fire immediately after dragend, before returning to the JS event loop, the 0ms setTimeout where we clear the handler would only ever fire after the click event. This should also take place fast enough that most human users would never make a subsequent click before the setTimeout fires.

This is a bit hacky as noted in https://github.com/mbostock/d3/issues/1005#issuecomment-15592805, but is probably less complicated than trying to discern cases/browsers/versions where the click does and does not fire.