@shgysk8zer0/polyfills 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +21 -0
  3. package/README.md +2 -0
  4. package/abort.js +194 -0
  5. package/all.js +30 -0
  6. package/animation.js +33 -0
  7. package/aom.js +43 -0
  8. package/appBadge.js +27 -0
  9. package/array.js +258 -0
  10. package/assets/CookieStore.js +230 -0
  11. package/assets/Lock.js +31 -0
  12. package/assets/LockManager.js +278 -0
  13. package/assets/Sanitizer.js +59 -0
  14. package/assets/SanitizerConfig.js +348 -0
  15. package/assets/SanitizerConfigBase.js +18 -0
  16. package/assets/SanitizerConfigEdge.js +335 -0
  17. package/assets/SanitizerConfigW3C.js +766 -0
  18. package/assets/Scheduler.js +124 -0
  19. package/assets/TextDecoder.js +83 -0
  20. package/assets/TextEncoder.js +41 -0
  21. package/assets/TrustedTypes.js +595 -0
  22. package/assets/attributes.js +15 -0
  23. package/assets/csp.js +29 -0
  24. package/assets/error.js +8 -0
  25. package/assets/sanitizerUtils.js +270 -0
  26. package/assets/trust.js +190 -0
  27. package/assets/utility.js +101 -0
  28. package/cookieStore.js +2 -0
  29. package/crypto.js +8 -0
  30. package/dialog.js +63 -0
  31. package/element.js +171 -0
  32. package/elementInternals.js +616 -0
  33. package/errors.js +21 -0
  34. package/function.js +31 -0
  35. package/globalThis.js +36 -0
  36. package/iterator.js +197 -0
  37. package/legacy/array.js +15 -0
  38. package/legacy/element.js +140 -0
  39. package/legacy/map.js +168 -0
  40. package/legacy/object.js +42 -0
  41. package/legacy.js +9 -0
  42. package/locks.js +33 -0
  43. package/map.js +32 -0
  44. package/match-media.js +58 -0
  45. package/math.js +69 -0
  46. package/navigator.js +55 -0
  47. package/number.js +14 -0
  48. package/package.json +52 -0
  49. package/performance.js +36 -0
  50. package/promise.js +70 -0
  51. package/sanitizer.js +3 -0
  52. package/scheduler.js +5 -0
  53. package/secure-context.js +31 -0
  54. package/set.js +73 -0
  55. package/share.js +17 -0
  56. package/symbols.js +9 -0
  57. package/textEncoder.js +16 -0
  58. package/trustedTypes.js +3 -0
  59. package/weakMap.js +28 -0
  60. package/window.js +85 -0
package/iterator.js ADDED
@@ -0,0 +1,197 @@
1
+ (function() {
2
+ 'use strict';
3
+
4
+ /**
5
+ * @see https://github.com/tc39/proposal-iterator-helpers
6
+ * @TODO implement `flat()`
7
+ * @TODO implement `flatMap()`
8
+ * @TODO implement `from()`
9
+ */
10
+ if (! ('Iterator' in globalThis)) {
11
+ globalThis.Iterator = {
12
+ 'prototype': Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())),
13
+ };
14
+ }
15
+
16
+ const Iterator = globalThis.Iterator;
17
+
18
+ if (! (Iterator.range instanceof Function)) {
19
+ Iterator.range = function* range(start, end, option) {
20
+ if (typeof option === 'number' || typeof option === 'bigint') {
21
+ for (const n of Iterator.range(start, end, { step: option })) {
22
+ yield n;
23
+ }
24
+ } else if (typeof option !== 'object' || Object.is(option, null)) {
25
+ for (const n of Iterator.range(start, end, {})) {
26
+ yield n;
27
+ }
28
+ } else {
29
+ const {
30
+ // Default to +/-, Number/BigInt based on start & end
31
+ step = typeof start === 'number'
32
+ ? start < end ? 1 : -1
33
+ : start < end ? 1n : -1n,
34
+ inclusive = false,
35
+ } = option;
36
+
37
+ if (typeof start !== 'number' && typeof start !== 'bigint') {
38
+ throw new TypeError('Start must be a number');
39
+ } else if (Number.isNaN(start)) {
40
+ throw new RangeError('Invalid start');
41
+ } else if (typeof end !== 'number' && typeof end !== 'bigint') {
42
+ throw new TypeError('End must be a number');
43
+ } else if (Number.isNaN(end)) {
44
+ throw new RangeError('Invalid end');
45
+ } else if (typeof step !== 'number' && typeof step !== 'bigint') {
46
+ throw new TypeError('Step must be a number');
47
+ } else if (Number.isNaN(step)) {
48
+ throw new RangeError('Invalid step');
49
+ } else if (step === 0) {
50
+ throw new RangeError('Step must not be 0');
51
+ } else if ((step < 0 && start < end) || (step > 0 && start > end)) {
52
+ return;
53
+ } else if (inclusive) {
54
+ if (step > 0) {
55
+ for (let n = start; n <= end; n+= step) {
56
+ yield n;
57
+ }
58
+ } else {
59
+ for (let n = start; n >= end; n+= step) {
60
+ yield n;
61
+ }
62
+ }
63
+ } else {
64
+ if (step > 0) {
65
+ for (let n = start; n < end; n+= step) {
66
+ yield n;
67
+ }
68
+ } else {
69
+ for (let n = start; n > end; n+= step) {
70
+ yield n;
71
+ }
72
+ }
73
+ }
74
+ }
75
+ };
76
+ }
77
+
78
+ if (! (Iterator.prototype[Symbol.toStringTag])) {
79
+ Iterator.prototype[Symbol.toStringTag] = 'Iterator';
80
+ }
81
+
82
+ if (! (Iterator.prototype.take instanceof Function)) {
83
+ Iterator.prototype.take = function* take(limit) {
84
+ let n = 0;
85
+
86
+ for (const item of this) {
87
+ if (++n > limit) {
88
+ break;
89
+ } else {
90
+ yield item;
91
+ }
92
+ }
93
+ };
94
+ }
95
+
96
+ if (! (Iterator.prototype.drop instanceof Function)) {
97
+ Iterator.prototype.drop = function* drop(limit) {
98
+ let n = 0;
99
+ for (const item of this) {
100
+ if (n++ >= limit) {
101
+ yield item;
102
+ }
103
+ }
104
+ };
105
+ }
106
+
107
+ if (! (Iterator.prototype.toArray instanceof Function)) {
108
+ Iterator.prototype.toArray = function toArray() {
109
+ return Array.from(this);
110
+ };
111
+ }
112
+
113
+ if (! (Iterator.prototype.forEach instanceof Function)) {
114
+ Iterator.prototype.forEach = function forEach(callback) {
115
+ for (const item of this) {
116
+ callback(item);
117
+ }
118
+ };
119
+ }
120
+
121
+ if (! (Iterator.prototype.map instanceof Function)) {
122
+ Iterator.prototype.map = function* map(callback) {
123
+ for (const item of this) {
124
+ yield callback(item);
125
+ }
126
+ };
127
+ }
128
+
129
+ if (! (Iterator.prototype.reduce instanceof Function)) {
130
+ Iterator.prototype.reduce = function reduce(callback, initialValue) {
131
+ let current = typeof initialValue === 'undefined' ? this.next().value : initialValue;
132
+
133
+ for (const item of this) {
134
+ current = callback(current, item);
135
+ }
136
+
137
+ return current;
138
+ };
139
+ }
140
+
141
+ if (! (Iterator.prototype.filter instanceof Function)) {
142
+ Iterator.prototype.filter = function* filter(callback) {
143
+ for (const item of this) {
144
+ if (callback(item)) {
145
+ yield item;
146
+ }
147
+ }
148
+ };
149
+ }
150
+
151
+ if (! (Iterator.prototype.some instanceof Function)) {
152
+ Iterator.prototype.some = function some(callback) {
153
+ let retVal = false;
154
+ for (const item of this) {
155
+ if (callback(item)) {
156
+ retVal = true;
157
+ break;
158
+ }
159
+ }
160
+
161
+ return retVal;
162
+ };
163
+ }
164
+
165
+ if (! (Iterator.prototype.every instanceof Function)) {
166
+ Iterator.prototype.every = function every(callback) {
167
+ let retVal = true;
168
+ for (const item of this) {
169
+ if (! callback(item)) {
170
+ retVal = false;
171
+ break;
172
+ }
173
+ }
174
+
175
+ return retVal;
176
+ };
177
+ }
178
+
179
+ if (! (Iterator.prototype.find instanceof Function)) {
180
+ Iterator.prototype.find = function find(callback) {
181
+ for (const item of this) {
182
+ if (callback(item)) {
183
+ return item;
184
+ }
185
+ }
186
+ };
187
+ }
188
+
189
+ if (! (Iterator.prototype.indexed instanceof Function)) {
190
+ Iterator.prototype.indexed = function* indexed() {
191
+ let n = 0;
192
+ for (const item of this) {
193
+ yield [n++, item];
194
+ }
195
+ };
196
+ }
197
+ })();
@@ -0,0 +1,15 @@
1
+ (function() {
2
+ 'use strict';
3
+
4
+ if (! (Array.from instanceof Function)) {
5
+ Array.from = function from(iter) {
6
+ return Array.of(...iter);
7
+ };
8
+ }
9
+
10
+ if (! (Array.of instanceof Function)) {
11
+ Array.of = function of(...items) {
12
+ return items;
13
+ };
14
+ }
15
+ })();
@@ -0,0 +1,140 @@
1
+ (function() {
2
+ 'use strict';
3
+
4
+ if (! (Element.prototype.closest instanceof Function)) {
5
+ Element.prototype.closest = function closest(selector) {
6
+ if (this.matches(selector)) {
7
+ return this;
8
+ } else {
9
+ let found = null;
10
+ let target = this.parentElement;
11
+
12
+ while(target instanceof Element) {
13
+ if (target.matches(selector)) {
14
+ found = target;
15
+ break;
16
+ } else {
17
+ target = target.parentElement;
18
+ }
19
+ }
20
+
21
+ return found;
22
+ }
23
+ };
24
+ }
25
+
26
+ if (! (Element.prototype.toggleAttribute instanceof Function)) {
27
+ Element.prototype.toggleAttribute = function(name, force) {
28
+ if (typeof force === 'undefined') {
29
+ return this.toggleAttribute(name, ! this.hasAttribute(name));
30
+ } else if (force) {
31
+ this.setAttribute(name, '');
32
+ return true;
33
+ } else {
34
+ this.removeAttribute(name);
35
+ return false;
36
+ }
37
+ };
38
+ }
39
+
40
+ if (! (Element.prototype.remove instanceof Function)) {
41
+ Element.prototype.remove = function remove() {
42
+ if (this.parentNode instanceof Node) {
43
+ this.parentNode.removeChild(this);
44
+ }
45
+ };
46
+ }
47
+
48
+ if (! (Element.prototype.after instanceof Function)) {
49
+ Element.prototype.after = function after(...items) {
50
+ items.forEach(item => {
51
+ if (item instanceof Node) {
52
+ this.insertAdjacentElement('afterend', item);
53
+ } else {
54
+ this.insertAdjacentText('afterend', item);
55
+ }
56
+ });
57
+ };
58
+ }
59
+
60
+ if (! (Element.prototype.before instanceof Function)) {
61
+ Element.prototype.before = function before(...items) {
62
+ items.forEach(item => {
63
+ if (item instanceof Node) {
64
+ this.insertAdjacentElement('beforebegin', item);
65
+ } else {
66
+ this.insertAdjacentText('beforebegin', item);
67
+ }
68
+ });
69
+ };
70
+ }
71
+
72
+ if (! (Element.prototype.append instanceof Function)) {
73
+ Element.prototype.append = function append(...items) {
74
+ items.forEach(item => {
75
+ if (item instanceof Node) {
76
+ this.appendChild(item);
77
+ } else {
78
+ this.appendChild(document.createTextNode(item));
79
+ }
80
+ });
81
+ };
82
+ }
83
+
84
+ if (! (Element.prototype.prepend instanceof Function)) {
85
+ Element.prototype.prepend = function prepend(...items) {
86
+ items.forEach(item => {
87
+ if (item instanceof Node) {
88
+ this.insertAdjacentElement('afterbegin', item);
89
+ } else {
90
+ this.insertAdjacentText('afterbegin', item);
91
+ }
92
+ });
93
+ };
94
+ }
95
+
96
+ if (! (Element.prototype.replaceWith instanceof Function)) {
97
+ Element.prototype.replaceWith = function replaceWith(...items) {
98
+ this.before(...items);
99
+ this.remove();
100
+ };
101
+ }
102
+
103
+ if (! (Element.prototype.replaceChildren instanceof Function)) {
104
+ Element.prototype.replaceChildren = function(...items) {
105
+ [...this.children].forEach(el => el.remove());
106
+ this.append(...items);
107
+ };
108
+
109
+ Document.prototype.replaceChildren = function(...items) {
110
+ Element.prototype.replaceChildren.apply(this, items);
111
+ };
112
+
113
+ DocumentFragment.prototype.replaceChildren = function(...items) {
114
+ Element.prototype.replaceChildren.apply(this, items);
115
+ };
116
+
117
+ if ('ShadowRoot' in globalThis) {
118
+ ShadowRoot.prototype.replaceChildren = function(...items) {
119
+ Element.prototype.replaceChildren.apply(this, items);
120
+ };
121
+ }
122
+ }
123
+
124
+ if (! (Element.prototype.getAttributeNames instanceof Function)) {
125
+ Element.prototype.getAttributeNames = function() {
126
+ return Array.from(this.attributes).map(({ name }) => name);
127
+ };
128
+ }
129
+
130
+ if (! ('hidden' in Element.prototype)) {
131
+ Object.defineProperty(Element.prototype, 'hidden', {
132
+ get: function() {
133
+ return this.hasAttribute('hidden');
134
+ },
135
+ set: function(value) {
136
+ this.toggleAttribute('hidden', value);
137
+ }
138
+ });
139
+ }
140
+ })();
package/legacy/map.js ADDED
@@ -0,0 +1,168 @@
1
+ (function() {
2
+ 'use strict';
3
+
4
+ if (! ('WeakMap' in globalThis)) {
5
+ const symbols = {
6
+ keys: Symbol('keys'),
7
+ values: Symbol('values'),
8
+ };
9
+
10
+ globalThis.WeakMap = class WeakMap {
11
+ constructor(init) {
12
+ Object.defineProperties(this, {
13
+ [symbols.keys]: {
14
+ enumerable: false,
15
+ configurable: false,
16
+ writable: false,
17
+ value: [],
18
+ },
19
+ [symbols.values]: {
20
+ enumerable: false,
21
+ configurable: false,
22
+ writable: false,
23
+ value: [],
24
+ },
25
+ });
26
+
27
+ if (typeof init !== 'undefined' && Symbol.iterator in init) {
28
+ for (const [key, value] of init) {
29
+ this.set(key, value);
30
+ }
31
+ }
32
+ }
33
+
34
+ has(key) {
35
+ return this[symbols.keys].includes(key);
36
+ }
37
+
38
+ set(key, value) {
39
+ const existing = this[symbols.keys].indexOf(key);
40
+
41
+ if (existing !== -1) {
42
+ this[symbols.values][existing] = value;
43
+ } else {
44
+ this[symbols.keys].push(key);
45
+ this[symbols.values].push(value);
46
+ }
47
+
48
+ return this;
49
+ }
50
+
51
+ get(key) {
52
+ const index = this[symbols.keys].indexOf(key);
53
+ return index === -1 ? undefined : this[symbols.values][index];
54
+ }
55
+
56
+ delete(key) {
57
+ const index = this[symbols.keys].indexOf(key);
58
+ if (index === -1) {
59
+ return false;
60
+ } else {
61
+ this[symbols.keys].splice(index, 1);
62
+ this[symbols.values].splice(index, 1);
63
+ return true;
64
+ }
65
+ }
66
+ };
67
+ }
68
+
69
+ if (! ('Map' in globalThis)) {
70
+ const symbols = {
71
+ keys: Symbol('keys'),
72
+ values: Symbol('values'),
73
+ };
74
+
75
+ globalThis.Map = class Map {
76
+ constructor(init) {
77
+ Object.defineProperties(this, {
78
+ [symbols.keys]: {
79
+ enumerable: false,
80
+ configurable: false,
81
+ writable: true,
82
+ value: [],
83
+ },
84
+ [symbols.values]: {
85
+ enumerable: false,
86
+ configurable: false,
87
+ writable: true,
88
+ value: [],
89
+ },
90
+ });
91
+
92
+ if (typeof init !== 'undefined' && Symbol.iterator in init) {
93
+ for (const [key, value] of init) {
94
+ this.set(key, value);
95
+ }
96
+ }
97
+ }
98
+
99
+ get size() {
100
+ return this[symbols.keys].length;
101
+ }
102
+
103
+ clear() {
104
+ this[symbols.keys] = [];
105
+ this[symbols.values] = [];
106
+ }
107
+
108
+ has(key) {
109
+ return this[symbols.keys].includes(key);
110
+ }
111
+
112
+ set(key, value) {
113
+ const existing = this[symbols.keys].indexOf(key);
114
+
115
+ if (existing !== -1) {
116
+ this[symbols.values][existing] = value;
117
+ } else {
118
+ this[symbols.keys].push(key);
119
+ this[symbols.values].push(value);
120
+ }
121
+
122
+ return this;
123
+ }
124
+
125
+ get(key) {
126
+ const index = this[symbols.keys].indexOf(key);
127
+ return index === -1 ? undefined : this[symbols.values][index];
128
+ }
129
+
130
+ delete(key) {
131
+ const index = this[symbols.keys].indexOf(key);
132
+ if (index === -1) {
133
+ return false;
134
+ } else {
135
+ this[symbols.keys].splice(index, 1);
136
+ this[symbols.values].splice(index, 1);
137
+ return true;
138
+ }
139
+ }
140
+
141
+ *keys() {
142
+ for (const key of this[symbols.keys]) {
143
+ yield key;
144
+ }
145
+ }
146
+
147
+ *values() {
148
+ for (const value of this[symbols.values]) {
149
+ yield value;
150
+ }
151
+ }
152
+
153
+ *entries() {
154
+ for (let n = 0; n < this.size; n++) {
155
+ yield [this[symbols.keys][n], this[symbols.values][n]];
156
+ }
157
+ }
158
+
159
+ [Symbol.iterator]() {
160
+ return this.entries();
161
+ }
162
+
163
+ forEach(callback, thisArg = globalThis) {
164
+ [...this.entries()].forEach(([key, value]) => callback.call(thisArg, value, key, this));
165
+ }
166
+ };
167
+ }
168
+ })();
@@ -0,0 +1,42 @@
1
+ (function() {
2
+ 'use strict';
3
+
4
+ if (! (Object.hasOwn instanceof Function)) {
5
+ Object.hasOwn = function hasOwn(obj, prop) {
6
+ return Object.prototype.hasOwnProperty.call(obj, prop);
7
+ };
8
+ }
9
+
10
+ if (! (Object.keys instanceof Function)) {
11
+ Object.keys = function keys(obj) {
12
+ const arr = [];
13
+
14
+ for (const k in obj) {
15
+ arr.push(k);
16
+ }
17
+
18
+ return arr;
19
+ };
20
+ }
21
+
22
+ if (! (Object.values instanceof Function)) {
23
+ Object.values = obj => Object.keys(obj).map(k => obj[k]);
24
+ }
25
+
26
+ if (! (Object.entries instanceof Function)) {
27
+ Object.entries = obj => Object.keys(obj).map(k => [k, obj[k]]);
28
+ }
29
+
30
+ if (! (Object.fromEntries instanceof Function)) {
31
+ Object.fromEntries = function(arr) {
32
+ if (Array.isArray(arr)) {
33
+ return arr.reduce((obj, [key, val]) => {
34
+ obj[key] = val;
35
+ return obj;
36
+ }, {});
37
+ } else {
38
+ return Object.fromEntries(Array.from(arr));
39
+ }
40
+ };
41
+ }
42
+ })();
package/legacy.js ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Import modules to improve support in legacy browsers.
3
+ * Note: load order may be crucial, as some polyfills may rely on
4
+ * e.g. `Object.fromEntries()`
5
+ */
6
+ import './legacy/object.js';
7
+ import './legacy/array.js';
8
+ import './legacy/map.js';
9
+ import './legacy/element.js';
package/locks.js ADDED
@@ -0,0 +1,33 @@
1
+ import { LockManager, actuallySupported, nativeSupport } from './assets/LockManager.js';
2
+ import { errorToEvent } from './assets/error.js';
3
+ let polyfilled = false;
4
+
5
+ const polyfilledPromise = new Promise(async resolve => {
6
+ if (nativeSupport) {
7
+ if (await actuallySupported) {
8
+ resolve(false);
9
+ } else {
10
+ try {
11
+ navigator.locks.request = LockManager.request;
12
+ navigator.locks.query = LockManager.query;
13
+ polyfilled = true;
14
+ resolve(true);
15
+ } catch(err) {
16
+ globalThis.dispatchEvent(errorToEvent(err));
17
+ resolve(false);
18
+ }
19
+ }
20
+ } else {
21
+ try {
22
+ navigator.locks = LockManager;
23
+ polyfilled = true;
24
+ resolve(true);
25
+ } catch(err) {
26
+ globalThis.dispatchEvent(errorToEvent(err));
27
+ resolve(false);
28
+ }
29
+ }
30
+ });
31
+
32
+
33
+ export { polyfilled, polyfilledPromise };
package/map.js ADDED
@@ -0,0 +1,32 @@
1
+ (function() {
2
+ 'use strict';
3
+
4
+ /**
5
+ * @see https://github.com/tc39/proposal-upsert
6
+ */
7
+
8
+ if (! (Map.prototype.emplace instanceof Function)) {
9
+ Map.prototype.emplace = function emplace(key, { insert, update } = {}) {
10
+ const has = this.has(key);
11
+
12
+ if (has && update instanceof Function) {
13
+ const existing = this.get(key);
14
+ const value = update.call(this, existing, key, this);
15
+
16
+ if (value !== existing) {
17
+ this.set(key, value);
18
+ }
19
+
20
+ return value;
21
+ } else if (has) {
22
+ return this.get(key);
23
+ } else if (insert instanceof Function) {
24
+ const value = insert.call(this, key, this);
25
+ this.set(key, value);
26
+ return value;
27
+ } else {
28
+ throw new Error('Key is not found and no `insert()` given');
29
+ }
30
+ };
31
+ }
32
+ })();
package/match-media.js ADDED
@@ -0,0 +1,58 @@
1
+ (function() {
2
+ 'use strict';
3
+
4
+ if (! ('MediaQueryListEvent' in globalThis)) {
5
+ /**
6
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryListEvent
7
+ */
8
+ globalThis.MediaQueryListEvent = class MediaQueryListEvent extends Event {
9
+ constructor(type, { media, matches } = {}) {
10
+ super(type);
11
+ Object.defineProperties(this, {
12
+ 'media': {
13
+ enumerable: true,
14
+ configurable: false,
15
+ writable: false,
16
+ value: media,
17
+ },
18
+ 'matches': {
19
+ enumerable: true,
20
+ configurable: false,
21
+ writable: false,
22
+ value: matches,
23
+ },
24
+ });
25
+ }
26
+ };
27
+ }
28
+
29
+ if ('MediaQueryList' in globalThis && ! (globalThis.MediaQueryList.prototype.addEventListener instanceof Function)) {
30
+ const targets = new WeakMap();
31
+
32
+ const listener = function listener() {
33
+ const { media, matches } = this;
34
+ this.dispatchEvent(new MediaQueryListEvent('change', { media, matches }));
35
+ };
36
+
37
+ const init = function init(mql) {
38
+ if (! targets.has(mql)) {
39
+ targets.set(mql, new EventTarget());
40
+ mql.addListener(listener.bind(mql));
41
+ }
42
+
43
+ return targets.get(mql);
44
+ };
45
+
46
+ globalThis.MediaQueryList.prototype.addEventListener = function addEventListener(type, callback, opts) {
47
+ init(this).addEventListener(type, callback, opts);
48
+ };
49
+
50
+ globalThis.MediaQueryList.prototype.removeEventListener = function removeEventListner(type, callback, opts) {
51
+ init(this).removeEventListener(type, callback, opts);
52
+ };
53
+
54
+ globalThis.MediaQueryList.prototype.dispatchEvent = function dispatchEvent(event) {
55
+ init(this).dispatchEvent(event);
56
+ };
57
+ }
58
+ })();