don't attach these event handler on document to prevent the event from bubbling up the whole DOM, which can lead to poor performance