10 examples of 'window.event.srcelement' in JavaScript

Every line of 'window.event.srcelement' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
94export function getTarget(event: any): HTMLElement {
95 if (!event) event = window.event;
96 return event.target || event.srcElement;
97}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

239dispatchEvent(evt) {
240 this.documentElement.dispatchEvent(evt)
241}
92function getTarget(event) {
93 if (!event)
94 event = window.event;
95 return event.target || event.srcElement;
96}
91handleEvent: function IE_handleEvent(event) {
92 switch (event.type) {
93 case "DOMNodeInserted":
94 if ("isPage" in this.site.data &&
95 !this.site.query("isPage", event.target, Boolean))
96 break;
97 // fall through
98 case "HB.PageInserted":
99 this.embed();
100 break;
101
102 case "GM_AutoPagerizeLoaded":
103 this.doc.addEventListener("DOMNodeInserted", this, false);
104 break;
105 }
106}
239function fEventTarget_dispatchEvent(oTarget, oEvent) {
240 // Start event flow
241 fEventTarget_routeEvent(oTarget, oEvent);
242 // Release event
243 oEvent.currentTarget = null;
244 oEvent.eventPhase = 0 /* cEvent.NONE */;
245
246 return !oEvent.defaultPrevented;
247};
8export function addEvent(target, eventType, callback) {
9 if (target.addEventListener) {
10 target.addEventListener(eventType, callback, false);
11 return {
12 remove() {
13 target.removeEventListener(eventType, callback, false);
14 }
15 };
16 } else if (target.attachEvent) {
17 target.attachEvent(`on${eventType}`, callback);
18 return {
19 remove() {
20 target.detachEvent(`on${eventType}`, callback);
21 }
22 };
23 }
24 return null;
25}
2function WindowEvent(w) {
3 Event.call(this, w, w);
4}
34function getEventTarget(editor, eventName) {
35 if (eventName == 'selectionchange') {
36 return editor.getDoc();
37 }
38
39 // Need to bind mousedown/mouseup etc to document not body in iframe mode
40 // Since the user might click on the HTML element not the BODY
41 if (!editor.inline && /^mouse|touch|click|contextmenu|drop|dragover|dragend/.test(eventName)) {
42 return editor.getDoc().documentElement;
43 }
44
45 // Bind to event root instead of body if it's defined
46 if (editor.settings.event_root) {
47 if (!editor.eventRoot) {
48 editor.eventRoot = DOM.select(editor.settings.event_root)[0];
49 }
50
51 return editor.eventRoot;
52 }
53
54 return editor.getBody();
55}
162on(event, handler, srcElement) {
163 this._addEventHandler(event, handler, srcElement, false);
164}
3export function dispatchEvent (element: Element, type: string,
4 eventInit: { bubbles?: boolean, cancelable?: boolean, detail: {} } = {}) {
5 const { bubbles = true, cancelable = true, detail = {} } = eventInit
6 const event = new CustomEvent(type, { bubbles, cancelable, detail })
7 element.dispatchEvent(event)
8 return event
9}

Related snippets