@appsurify-testmap/rrdom-nodejs 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.
@@ -75,27 +75,59 @@ const interactiveEvents = [
75
75
  "touchend",
76
76
  "touchcancel"
77
77
  ];
78
+ const inlineEventAttributes = [
79
+ "onclick",
80
+ "ondblclick",
81
+ "onmousedown",
82
+ "onmouseup",
83
+ "onmouseover",
84
+ "onmouseout",
85
+ "onmousemove",
86
+ "onfocus",
87
+ "onblur",
88
+ "onkeydown",
89
+ "onkeypress",
90
+ "onkeyup",
91
+ "onchange",
92
+ "oninput",
93
+ "onsubmit",
94
+ "onreset",
95
+ "onselect",
96
+ "oncontextmenu",
97
+ "ontouchstart",
98
+ "ontouchmove",
99
+ "ontouchend",
100
+ "ontouchcancel"
101
+ ];
78
102
  const interactiveElementsRegistry = /* @__PURE__ */ new WeakSet();
79
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
80
- const originalAddEventListener = EventTarget.prototype.addEventListener;
81
- EventTarget.prototype.addEventListener = function(type, listener, options) {
82
- originalAddEventListener.call(this, type, listener, options);
83
- if (this instanceof Element) {
84
- const eventType = type.toLowerCase();
85
- if (interactiveEvents.includes(eventType)) {
86
- interactiveElementsRegistry.add(this);
87
- }
103
+ const originalAddEventListener = EventTarget.prototype.addEventListener;
104
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
105
+ originalAddEventListener.call(this, type, listener, options);
106
+ if (this instanceof Element) {
107
+ const eventType = type.toLowerCase();
108
+ if (interactiveEvents.includes(eventType)) {
109
+ interactiveElementsRegistry.add(this);
88
110
  }
89
- };
111
+ }
112
+ };
113
+ const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
114
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
115
+ originalRemoveEventListener.call(this, type, listener, options);
116
+ };
117
+ function inspectInlineEventHandlers() {
118
+ const allElements = document.querySelectorAll("*");
119
+ allElements.forEach((el) => {
120
+ inlineEventAttributes.forEach((attr) => {
121
+ if (el.hasAttribute(attr)) {
122
+ interactiveElementsRegistry.add(el);
123
+ }
124
+ });
125
+ });
90
126
  }
91
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
92
- const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
93
- EventTarget.prototype.removeEventListener = function(type, listener, options) {
94
- originalRemoveEventListener.call(this, type, listener, options);
95
- if (this instanceof Element) {
96
- type.toLowerCase();
97
- }
98
- };
127
+ if (document.readyState === "complete" || document.readyState === "interactive") {
128
+ inspectInlineEventHandlers();
129
+ } else {
130
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
99
131
  }
100
132
  function getDefaultExportFromCjs(x2) {
101
133
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;