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