listen to events on document instead