small refactor of dom event methods