Implement DOM-free event dispatching.