@appsurify-testmap/rrweb 2.1.1-alpha.1 → 2.1.1-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/rrweb.cjs CHANGED
@@ -739,6 +739,19 @@ const interactiveEvents$1 = [
739
739
  "touchend",
740
740
  "touchcancel"
741
741
  ];
742
+ const interactiveTags = [
743
+ "a",
744
+ "button",
745
+ "input",
746
+ "select",
747
+ "textarea",
748
+ "label",
749
+ "details",
750
+ "summary",
751
+ "dialog",
752
+ "video",
753
+ "audio"
754
+ ];
742
755
  const inlineEventAttributes$1 = [
743
756
  "onclick",
744
757
  "ondblclick",
@@ -778,6 +791,25 @@ const originalRemoveEventListener$1 = EventTarget.prototype.removeEventListener;
778
791
  EventTarget.prototype.removeEventListener = function(type, listener, options) {
779
792
  originalRemoveEventListener$1.call(this, type, listener, options);
780
793
  };
794
+ function hasEventListeners(n2) {
795
+ return n2 instanceof Element && interactiveElementsRegistry$1.has(n2);
796
+ }
797
+ function isElementInteractive(n2) {
798
+ if (n2.nodeType === Node.ELEMENT_NODE) {
799
+ const element = n2;
800
+ const tagName = element.tagName.toLowerCase();
801
+ if (interactiveTags.includes(tagName)) {
802
+ return true;
803
+ }
804
+ const hasTabIndex = element.hasAttribute("tabindex") && element.getAttribute("tabindex") !== "-1";
805
+ const hasRoleInteractive = ["button", "link", "checkbox", "switch", "menuitem"].includes(
806
+ element.getAttribute("role") || ""
807
+ );
808
+ const result2 = hasEventListeners(element) || hasTabIndex || hasRoleInteractive || element instanceof HTMLAnchorElement && element.hasAttribute("href") || element instanceof HTMLButtonElement && !element.disabled;
809
+ return result2;
810
+ }
811
+ return false;
812
+ }
781
813
  function inspectInlineEventHandlers$1() {
782
814
  const allElements = document.querySelectorAll("*");
783
815
  allElements.forEach((el) => {
@@ -1467,6 +1499,7 @@ function serializeNodeWithId(n2, options) {
1467
1499
  }
1468
1500
  if (n2.nodeType === Node.ELEMENT_NODE) {
1469
1501
  serializedNode.isVisible = isElementVisible(n2);
1502
+ serializedNode.isInteractive = isElementInteractive(n2);
1470
1503
  }
1471
1504
  }
1472
1505
  mirror2.add(n2, serializedNode);