@appsurify-testmap/rrweb-record 2.0.0-alpha.21 → 2.0.0-alpha.23

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.
@@ -156,23 +156,71 @@ const index$1 = {
156
156
  querySelectorAll: querySelectorAll$1,
157
157
  mutationObserver: mutationObserverCtor$1
158
158
  };
159
- function getXPath(n2) {
160
- if (n2.id) {
161
- return `//*[@id="${n2.id}"]`;
159
+ function getXPath(node2) {
160
+ if (node2.nodeType === Node.DOCUMENT_NODE) {
161
+ return "/";
162
162
  }
163
- if (n2 === document.body) {
164
- return "/html/body";
163
+ if (node2.nodeType === Node.DOCUMENT_TYPE_NODE) {
164
+ return "/html/doctype";
165
165
  }
166
- const parentNode2 = index$1.parentNode(n2);
167
- if (!parentNode2 || !(parentNode2 instanceof Element)) {
168
- return "";
166
+ if (node2.nodeType === Node.ELEMENT_NODE) {
167
+ const element = node2;
168
+ if (element.id) {
169
+ return `//*[@id="${element.id}"]`;
170
+ }
171
+ if (element.tagName && element.tagName.toLowerCase() === "html") {
172
+ return "/html";
173
+ }
174
+ if (element === document.head) {
175
+ return "/html/head";
176
+ }
177
+ if (element === document.body) {
178
+ return "/html/body";
179
+ }
180
+ const parentNode2 = element.parentNode;
181
+ if (!parentNode2 || !(parentNode2 instanceof Element)) {
182
+ return "";
183
+ }
184
+ const siblings = Array.from(parentNode2.children).filter(
185
+ (sibling) => sibling.tagName === element.tagName
186
+ );
187
+ const index2 = siblings.length > 1 ? `[${siblings.indexOf(element) + 1}]` : "";
188
+ return `${getXPath(parentNode2)}/${element.tagName.toLowerCase()}${index2}`;
169
189
  }
170
- const siblings = Array.from(parentNode2.children).filter(
171
- (node2) => node2.tagName === n2.tagName
172
- );
173
- const index$1$1 = siblings.length > 1 ? `[${siblings.indexOf(n2) + 1}]` : "";
174
- const path = getXPath(parentNode2) + "/" + n2.tagName.toLowerCase() + index$1$1;
175
- return path;
190
+ if (node2.nodeType === Node.TEXT_NODE) {
191
+ const parent = node2.parentNode;
192
+ if (!parent) {
193
+ return "";
194
+ }
195
+ const textSiblings = Array.from(parent.childNodes).filter(
196
+ (sibling) => sibling.nodeType === Node.TEXT_NODE
197
+ );
198
+ const index2 = textSiblings.length > 1 ? `[${textSiblings.indexOf(node2) + 1}]` : "";
199
+ return `${getXPath(parent)}/text()${index2}`;
200
+ }
201
+ if (node2.nodeType === Node.CDATA_SECTION_NODE) {
202
+ const parent = node2.parentNode;
203
+ if (!parent) {
204
+ return "";
205
+ }
206
+ const cdataSiblings = Array.from(parent.childNodes).filter(
207
+ (sibling) => sibling.nodeType === Node.CDATA_SECTION_NODE
208
+ );
209
+ const index2 = cdataSiblings.length > 1 ? `[${cdataSiblings.indexOf(node2) + 1}]` : "";
210
+ return `${getXPath(parent)}/text()${index2}`;
211
+ }
212
+ if (node2.nodeType === Node.COMMENT_NODE) {
213
+ const parent = node2.parentNode;
214
+ if (!parent) {
215
+ return "";
216
+ }
217
+ const commentSiblings = Array.from(parent.childNodes).filter(
218
+ (sibling) => sibling.nodeType === Node.COMMENT_NODE
219
+ );
220
+ const index2 = commentSiblings.length > 1 ? `[${commentSiblings.indexOf(node2) + 1}]` : "";
221
+ return `${getXPath(parent)}/comment()${index2}`;
222
+ }
223
+ return "";
176
224
  }
177
225
  function isElement(n2) {
178
226
  return n2.nodeType === n2.ELEMENT_NODE;
@@ -1895,7 +1943,7 @@ function cloneNode$1(obj, parent) {
1895
1943
  }
1896
1944
  return cloned;
1897
1945
  }
1898
- let Node$4$1 = class Node2 {
1946
+ let Node$5$1 = class Node2 {
1899
1947
  constructor(defaults = {}) {
1900
1948
  this.raws = {};
1901
1949
  this[isClean$2$1] = false;
@@ -2187,10 +2235,10 @@ let Node$4$1 = class Node2 {
2187
2235
  return this;
2188
2236
  }
2189
2237
  };
2190
- var node$1 = Node$4$1;
2191
- Node$4$1.default = Node$4$1;
2192
- let Node$3$1 = node$1;
2193
- let Declaration$4$1 = class Declaration extends Node$3$1 {
2238
+ var node$1 = Node$5$1;
2239
+ Node$5$1.default = Node$5$1;
2240
+ let Node$4$1 = node$1;
2241
+ let Declaration$4$1 = class Declaration extends Node$4$1 {
2194
2242
  constructor(defaults) {
2195
2243
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
2196
2244
  defaults = { ...defaults, value: String(defaults.value) };
@@ -2846,8 +2894,8 @@ let MapGenerator$2$1 = class MapGenerator {
2846
2894
  }
2847
2895
  };
2848
2896
  var mapGenerator$1 = MapGenerator$2$1;
2849
- let Node$2$1 = node$1;
2850
- let Comment$4$1 = class Comment extends Node$2$1 {
2897
+ let Node$3$1 = node$1;
2898
+ let Comment$4$1 = class Comment extends Node$3$1 {
2851
2899
  constructor(defaults) {
2852
2900
  super(defaults);
2853
2901
  this.type = "comment";
@@ -2858,7 +2906,7 @@ Comment$4$1.default = Comment$4$1;
2858
2906
  let { isClean: isClean$1$1, my: my$1$1 } = symbols$1;
2859
2907
  let Declaration$3$1 = declaration$1;
2860
2908
  let Comment$3$1 = comment$1;
2861
- let Node$1$1 = node$1;
2909
+ let Node$2$1 = node$1;
2862
2910
  let parse$4$1, Rule$4$1, AtRule$4$1, Root$6$1;
2863
2911
  function cleanSource$1(nodes) {
2864
2912
  return nodes.map((i2) => {
@@ -2875,7 +2923,7 @@ function markDirtyUp$1(node2) {
2875
2923
  }
2876
2924
  }
2877
2925
  }
2878
- let Container$7$1 = class Container extends Node$1$1 {
2926
+ let Container$7$1 = class Container extends Node$2$1 {
2879
2927
  append(...children) {
2880
2928
  for (let child of children) {
2881
2929
  let nodes = this.normalize(child, this.last);
@@ -4902,7 +4950,7 @@ let parse$5 = parse_1$1;
4902
4950
  let list$3 = list_1$1;
4903
4951
  let Rule2$1 = rule$1;
4904
4952
  let Root2$1 = root$1;
4905
- let Node2$1 = node$1;
4953
+ let Node$1$1 = node$1;
4906
4954
  function postcss$3(...plugins) {
4907
4955
  if (plugins.length === 1 && Array.isArray(plugins[0])) {
4908
4956
  plugins = plugins[0];
@@ -4962,7 +5010,7 @@ postcss$3.Result = Result2$1;
4962
5010
  postcss$3.Input = Input2$1;
4963
5011
  postcss$3.Rule = Rule2$1;
4964
5012
  postcss$3.Root = Root2$1;
4965
- postcss$3.Node = Node2$1;
5013
+ postcss$3.Node = Node$1$1;
4966
5014
  LazyResult2$1.registerPostcss(postcss$3);
4967
5015
  var postcss_1$1 = postcss$3;
4968
5016
  postcss$3.default = postcss$3;
@@ -5447,7 +5495,7 @@ function cloneNode(obj, parent) {
5447
5495
  }
5448
5496
  return cloned;
5449
5497
  }
5450
- let Node$4 = class Node3 {
5498
+ let Node$5 = class Node22 {
5451
5499
  constructor(defaults = {}) {
5452
5500
  this.raws = {};
5453
5501
  this[isClean$2] = false;
@@ -5739,10 +5787,10 @@ let Node$4 = class Node3 {
5739
5787
  return this;
5740
5788
  }
5741
5789
  };
5742
- var node = Node$4;
5743
- Node$4.default = Node$4;
5744
- let Node$3 = node;
5745
- let Declaration$4 = class Declaration2 extends Node$3 {
5790
+ var node = Node$5;
5791
+ Node$5.default = Node$5;
5792
+ let Node$4 = node;
5793
+ let Declaration$4 = class Declaration2 extends Node$4 {
5746
5794
  constructor(defaults) {
5747
5795
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
5748
5796
  defaults = { ...defaults, value: String(defaults.value) };
@@ -6398,8 +6446,8 @@ let MapGenerator$2 = class MapGenerator2 {
6398
6446
  }
6399
6447
  };
6400
6448
  var mapGenerator = MapGenerator$2;
6401
- let Node$2 = node;
6402
- let Comment$4 = class Comment2 extends Node$2 {
6449
+ let Node$3 = node;
6450
+ let Comment$4 = class Comment2 extends Node$3 {
6403
6451
  constructor(defaults) {
6404
6452
  super(defaults);
6405
6453
  this.type = "comment";
@@ -6410,7 +6458,7 @@ Comment$4.default = Comment$4;
6410
6458
  let { isClean: isClean$1, my: my$1 } = symbols;
6411
6459
  let Declaration$3 = declaration;
6412
6460
  let Comment$3 = comment;
6413
- let Node$1 = node;
6461
+ let Node$2 = node;
6414
6462
  let parse$4, Rule$4, AtRule$4, Root$6;
6415
6463
  function cleanSource(nodes) {
6416
6464
  return nodes.map((i2) => {
@@ -6427,7 +6475,7 @@ function markDirtyUp(node2) {
6427
6475
  }
6428
6476
  }
6429
6477
  }
6430
- let Container$7 = class Container2 extends Node$1 {
6478
+ let Container$7 = class Container2 extends Node$2 {
6431
6479
  append(...children) {
6432
6480
  for (let child of children) {
6433
6481
  let nodes = this.normalize(child, this.last);
@@ -8454,7 +8502,7 @@ let parse = parse_1;
8454
8502
  let list = list_1;
8455
8503
  let Rule22 = rule;
8456
8504
  let Root22 = root;
8457
- let Node22 = node;
8505
+ let Node$1 = node;
8458
8506
  function postcss(...plugins) {
8459
8507
  if (plugins.length === 1 && Array.isArray(plugins[0])) {
8460
8508
  plugins = plugins[0];
@@ -8514,7 +8562,7 @@ postcss.Result = Result22;
8514
8562
  postcss.Input = Input22;
8515
8563
  postcss.Rule = Rule22;
8516
8564
  postcss.Root = Root22;
8517
- postcss.Node = Node22;
8565
+ postcss.Node = Node$1;
8518
8566
  LazyResult22.registerPostcss(postcss);
8519
8567
  var postcss_1 = postcss;
8520
8568
  postcss.default = postcss;