Replaced dom event handling with custom event handling and bubbling algorithm.