/** * @param target can be any DOM Element or other EventTarget * @param type Event type (i.e. 'click') * @param doc Placeholder for document * @param event Placeholder for creating an Event */ function (target, type, doc, event) { doc = document; if (doc.createEvent) { event = new Event(type); target.dispatchEvent(event); } else { event = doc.createEventObject(); target.fireEvent('on' + type, event); } };