rem: element.dispatchEvent(evt); 
add: element.dispatchEvent(evt); 
context: function triggerMouseEvent(element, eventType, canBubble, clientX, clientY) {    clientX = clientX ? clientX : 0;    clientY = clientY ? clientY : 0;    // TODO: set these attributes -- they don't seem to be needed by the initial test cases, but that could change...    var screenX = 0;    var screenY = 0;    canBubble = (typeof(canBubble) == undefined) ? true : canBubble;    if (element.fireEvent) {        if (!screenX && !screenY && !clientX && !clientY) {            element.fireEvent('on' + eventType);        }        else {            var ieEvent = element.ownerDocument.createEventObject();            ieEvent.detail = 0;            ieEvent.screenX = screenX;            ieEvent.screenY = screenY;            ieEvent.clientX = clientX;            ieEvent.clientY = clientY;            ieEvent.ctrlKey = false;            ieEvent.altKey = false;            ieEvent.shiftKey = false;            ieEvent.metaKey = false;            ieEvent.button = 1;            ieEvent.relatedTarget = null;            // when we go this route, window.event is never set to contain the event we have just created.            // ideally we could just slide it in as follows in the try-block below, but this normally            // doesn't work.  This is why I try to avoid this code path, which is only required if we need to            // set attributes on the event (e.g., clientX).            try {                window.event = ieEvent;            }            catch(e) {                // getting an "Object does not support this action or property" error.  Save the event away                // for future reference.                // TODO: is there a way to update window.event?                // work around for http://jira.openqa.org/browse/SEL-280 -- make the event available somewhere:                selenium.browserbot.getCurrentWindow().selenium_event = ieEvent;            }            element.fireEvent('on' + eventType, ieEvent);        }    }    else {        var evt = document.createEvent('MouseEvents');        if (evt.initMouseEvent)        {            evt.initMouseEvent(eventType, canBubble, true, document.defaultView, 1, screenX, screenY, clientX, clientY, false, false, false, false, 0, null)        }        else        {            // Safari            // TODO we should be initialising other mouse-event related attributes here            evt.initEvent(eventType, canBubble, true);        }        element.dispatchEvent(evt);    }}
meta: 3428	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/3428/b69d877d29f6d9f09c4d4fb1daa72faa817ad3a2/htmlutils.js/clean/code/javascript/core/scripts/htmlutils.js