@appsurify-testmap/rrdom 2.0.0-alpha.41 → 2.1.0-alpha.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.
package/dist/rrdom.cjs CHANGED
@@ -89,27 +89,59 @@ const interactiveEvents = [
89
89
  "touchend",
90
90
  "touchcancel"
91
91
  ];
92
+ const inlineEventAttributes = [
93
+ "onclick",
94
+ "ondblclick",
95
+ "onmousedown",
96
+ "onmouseup",
97
+ "onmouseover",
98
+ "onmouseout",
99
+ "onmousemove",
100
+ "onfocus",
101
+ "onblur",
102
+ "onkeydown",
103
+ "onkeypress",
104
+ "onkeyup",
105
+ "onchange",
106
+ "oninput",
107
+ "onsubmit",
108
+ "onreset",
109
+ "onselect",
110
+ "oncontextmenu",
111
+ "ontouchstart",
112
+ "ontouchmove",
113
+ "ontouchend",
114
+ "ontouchcancel"
115
+ ];
92
116
  const interactiveElementsRegistry = /* @__PURE__ */ new WeakSet();
93
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
94
- const originalAddEventListener = EventTarget.prototype.addEventListener;
95
- EventTarget.prototype.addEventListener = function(type, listener, options) {
96
- originalAddEventListener.call(this, type, listener, options);
97
- if (this instanceof Element) {
98
- const eventType = type.toLowerCase();
99
- if (interactiveEvents.includes(eventType)) {
100
- interactiveElementsRegistry.add(this);
101
- }
117
+ const originalAddEventListener = EventTarget.prototype.addEventListener;
118
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
119
+ originalAddEventListener.call(this, type, listener, options);
120
+ if (this instanceof Element) {
121
+ const eventType = type.toLowerCase();
122
+ if (interactiveEvents.includes(eventType)) {
123
+ interactiveElementsRegistry.add(this);
102
124
  }
103
- };
125
+ }
126
+ };
127
+ const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
128
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
129
+ originalRemoveEventListener.call(this, type, listener, options);
130
+ };
131
+ function inspectInlineEventHandlers() {
132
+ const allElements = document.querySelectorAll("*");
133
+ allElements.forEach((el) => {
134
+ inlineEventAttributes.forEach((attr) => {
135
+ if (el.hasAttribute(attr)) {
136
+ interactiveElementsRegistry.add(el);
137
+ }
138
+ });
139
+ });
104
140
  }
105
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
106
- const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
107
- EventTarget.prototype.removeEventListener = function(type, listener, options) {
108
- originalRemoveEventListener.call(this, type, listener, options);
109
- if (this instanceof Element) {
110
- type.toLowerCase();
111
- }
112
- };
141
+ if (document.readyState === "complete" || document.readyState === "interactive") {
142
+ inspectInlineEventHandlers();
143
+ } else {
144
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
113
145
  }
114
146
  function getDefaultExportFromCjs(x2) {
115
147
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;