@appsurify-testmap/rrdom 2.0.0-alpha.41 → 2.1.0-alpha.1

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.
@@ -133,27 +133,59 @@ const interactiveEvents = [
133
133
  "touchend",
134
134
  "touchcancel"
135
135
  ];
136
+ const inlineEventAttributes = [
137
+ "onclick",
138
+ "ondblclick",
139
+ "onmousedown",
140
+ "onmouseup",
141
+ "onmouseover",
142
+ "onmouseout",
143
+ "onmousemove",
144
+ "onfocus",
145
+ "onblur",
146
+ "onkeydown",
147
+ "onkeypress",
148
+ "onkeyup",
149
+ "onchange",
150
+ "oninput",
151
+ "onsubmit",
152
+ "onreset",
153
+ "onselect",
154
+ "oncontextmenu",
155
+ "ontouchstart",
156
+ "ontouchmove",
157
+ "ontouchend",
158
+ "ontouchcancel"
159
+ ];
136
160
  const interactiveElementsRegistry = /* @__PURE__ */ new WeakSet();
137
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
138
- const originalAddEventListener = EventTarget.prototype.addEventListener;
139
- EventTarget.prototype.addEventListener = function(type, listener, options) {
140
- originalAddEventListener.call(this, type, listener, options);
141
- if (this instanceof Element) {
142
- const eventType = type.toLowerCase();
143
- if (interactiveEvents.includes(eventType)) {
144
- interactiveElementsRegistry.add(this);
145
- }
161
+ const originalAddEventListener = EventTarget.prototype.addEventListener;
162
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
163
+ originalAddEventListener.call(this, type, listener, options);
164
+ if (this instanceof Element) {
165
+ const eventType = type.toLowerCase();
166
+ if (interactiveEvents.includes(eventType)) {
167
+ interactiveElementsRegistry.add(this);
146
168
  }
147
- };
169
+ }
170
+ };
171
+ const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
172
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
173
+ originalRemoveEventListener.call(this, type, listener, options);
174
+ };
175
+ function inspectInlineEventHandlers() {
176
+ const allElements = document.querySelectorAll("*");
177
+ allElements.forEach((el) => {
178
+ inlineEventAttributes.forEach((attr) => {
179
+ if (el.hasAttribute(attr)) {
180
+ interactiveElementsRegistry.add(el);
181
+ }
182
+ });
183
+ });
148
184
  }
149
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
150
- const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
151
- EventTarget.prototype.removeEventListener = function(type, listener, options) {
152
- originalRemoveEventListener.call(this, type, listener, options);
153
- if (this instanceof Element) {
154
- type.toLowerCase();
155
- }
156
- };
185
+ if (document.readyState === "complete" || document.readyState === "interactive") {
186
+ inspectInlineEventHandlers();
187
+ } else {
188
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
157
189
  }
158
190
  function getDefaultExportFromCjs(x2) {
159
191
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;