Change click browser event on mousedown.
Remove data-clickout saving because it is lost after update element.
Execute handler only for visible elements.
Change 'this' in callback on target instead of document.
Repair unbind clickout event.