support IE11 custom events, refactor code

2 jobs for merge_mapviewer in 2 minutes and 25 seconds (queued for 2 seconds)