1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'use strict';
export function _addRootElement(rootElem) {
document.body.insertBefore(
rootElem,
document.body.lastElementChild.nextElementSibling
);
}
export function _getSelection(_u) {
return window.getSelection();
}
export function _stringify(j, indent) {
return JSON.stringify(j, null, indent);
}
export function _postMessage(obj, msg, src) {
obj.contentWindow.postMessage(msg, src);
}
export function _setCookie(c) {
document.cookie = c;
}
export function _domRectFromRect(obj) {
return DOMRectReadOnly.fromRect(obj)
}
export function _preventDefault(e) {
return e.preventDefault();
}
export function _stopPropagation(e) {
return e.stopPropagation();
}
export function _blur(el) {
return el.blur();
}
export function _triggerEvent(el, evtType) {
// https://stackoverflow.com/questions/8789423/trigger-onchange-event
var event = new UIEvent(evtType, {
view: window,
bubbles: true,
cancelable: true
});
el.dispatchEvent(event);
}
export function _keyCode(e) {
// https://www.w3schools.com/jsref/event_key_keycode.asp
return e.which || e.keyCode;
}