Encapsulate DOM events using the event emitter to allow testing.
Added targetElementWidth and targetElementHeight configuration.