Popup: Fixes closing the popup unexpectedly by race conditions. #668

Closed
wants to merge 4 commits into
from
Commits on May 26, 2012
  1. @rxaviers

    Popup: Added _closeTry and _closeVet methods. Fixes closing the popup…

    rxaviers committed May 26, 2012
    … unexpectedly by race conditions.
    
    - A focusout followed by a focusin sometimes trigger events in reverse order,
      but should not close the popup nevertheless. Or a click-in-the-popup followed
      by a focusout should also avoid closing it unexpectedly;
    - _closeTry and _closeVet work together to close the popup, but making sure no
      other event vets it;
  2. @rxaviers

    Popup: Binds document mousedown instead of click. The click event is …

    rxaviers committed May 26, 2012
    …triggered when the mouse button is released, which virtually always exceeds _closeTry delay, leading to erroneous popup close.
  3. @rxaviers

    Popup: Manually binding document instead of using _bind. Because on d…

    rxaviers committed May 26, 2012
    …estroy, it doesn't unbind other popup instances.
  4. @rxaviers

    Popup: Lowered the closing delay from 150ms to 50ms. Makes response f…

    rxaviers committed May 26, 2012
    …aster since the _closeTry and _closeVet approach is working smooth.