@appsurify-testmap/rrdom-nodejs 2.0.0-alpha.35 → 2.0.0-alpha.41

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.
@@ -31,59 +31,27 @@ const interactiveEvents = [
31
31
  "touchend",
32
32
  "touchcancel"
33
33
  ];
34
- const inlineEventAttributes = [
35
- "onclick",
36
- "ondblclick",
37
- "onmousedown",
38
- "onmouseup",
39
- "onmouseover",
40
- "onmouseout",
41
- "onmousemove",
42
- "onfocus",
43
- "onblur",
44
- "onkeydown",
45
- "onkeypress",
46
- "onkeyup",
47
- "onchange",
48
- "oninput",
49
- "onsubmit",
50
- "onreset",
51
- "onselect",
52
- "oncontextmenu",
53
- "ontouchstart",
54
- "ontouchmove",
55
- "ontouchend",
56
- "ontouchcancel"
57
- ];
58
34
  const interactiveElementsRegistry = /* @__PURE__ */ new WeakSet();
59
- const originalAddEventListener = EventTarget.prototype.addEventListener;
60
- EventTarget.prototype.addEventListener = function(type, listener, options) {
61
- originalAddEventListener.call(this, type, listener, options);
62
- if (this instanceof Element) {
63
- const eventType = type.toLowerCase();
64
- if (interactiveEvents.includes(eventType)) {
65
- interactiveElementsRegistry.add(this);
66
- }
67
- }
68
- };
69
- const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
70
- EventTarget.prototype.removeEventListener = function(type, listener, options) {
71
- originalRemoveEventListener.call(this, type, listener, options);
72
- };
73
- function inspectInlineEventHandlers() {
74
- const allElements = document.querySelectorAll("*");
75
- allElements.forEach((el) => {
76
- inlineEventAttributes.forEach((attr) => {
77
- if (el.hasAttribute(attr)) {
78
- interactiveElementsRegistry.add(el);
35
+ if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
36
+ const originalAddEventListener = EventTarget.prototype.addEventListener;
37
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
38
+ originalAddEventListener.call(this, type, listener, options);
39
+ if (this instanceof Element) {
40
+ const eventType = type.toLowerCase();
41
+ if (interactiveEvents.includes(eventType)) {
42
+ interactiveElementsRegistry.add(this);
79
43
  }
80
- });
81
- });
44
+ }
45
+ };
82
46
  }
83
- if (document.readyState === "complete" || document.readyState === "interactive") {
84
- inspectInlineEventHandlers();
85
- } else {
86
- document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
47
+ if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
48
+ const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
49
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
50
+ originalRemoveEventListener.call(this, type, listener, options);
51
+ if (this instanceof Element) {
52
+ type.toLowerCase();
53
+ }
54
+ };
87
55
  }
88
56
  function getDefaultExportFromCjs(x2) {
89
57
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;