Outlook_Addin_LLM/node_modules/@fluentui/utilities/lib/dom/raiseClick.js

26 lines
895 B
JavaScript
Raw Normal View History

import { getDocument } from './getDocument';
/** Raises a click event.
* @deprecated Moved to `FocusZone` component since it was the only place internally using this function.
*/
export function raiseClick(target, doc) {
var theDoc = doc !== null && doc !== void 0 ? doc : getDocument();
var event = createNewEvent('MouseEvents', theDoc);
// eslint-disable-next-line deprecation/deprecation
event.initEvent('click', true, true);
target.dispatchEvent(event);
}
function createNewEvent(eventName, doc) {
var event;
if (typeof Event === 'function') {
// Chrome, Opera, Firefox
event = new Event(eventName);
}
else {
// IE
event = doc.createEvent('Event');
// eslint-disable-next-line deprecation/deprecation
event.initEvent(eventName, true, true);
}
return event;
}
//# sourceMappingURL=raiseClick.js.map