Implement DOM-free event dispatching.
Add event tests.