I assume it's javascript ; normally any object that can get a reference to a DOM element should be able to dispatch an event using the element.dispatchEvent function ; see :
https://developer.mozilla.org/en/DOM/document.createEvent
https://developer.mozilla.org/en/DOM/element.dispatchEvent