@appsurify-testmap/rrweb 2.0.0-alpha.22 → 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.
package/dist/rrweb.cjs CHANGED
@@ -158,25 +158,71 @@ const index$1 = {
158
158
  querySelectorAll: querySelectorAll$1,
159
159
  mutationObserver: mutationObserverCtor$1
160
160
  };
161
- function getXPath(n2) {
162
- if (n2.id) {
163
- return `//*[@id="${n2.id}"]`;
161
+ function getXPath(node2) {
162
+ if (node2.nodeType === Node.DOCUMENT_NODE) {
163
+ return "/";
164
164
  }
165
- if (n2 === document.body) {
166
- return "/html/body";
165
+ if (node2.nodeType === Node.DOCUMENT_TYPE_NODE) {
166
+ return "/html/doctype";
167
167
  }
168
- if (!n2.tagName) {
169
- return "";
168
+ if (node2.nodeType === Node.ELEMENT_NODE) {
169
+ const element = node2;
170
+ if (element.id) {
171
+ return `//*[@id="${element.id}"]`;
172
+ }
173
+ if (element.tagName && element.tagName.toLowerCase() === "html") {
174
+ return "/html";
175
+ }
176
+ if (element === document.head) {
177
+ return "/html/head";
178
+ }
179
+ if (element === document.body) {
180
+ return "/html/body";
181
+ }
182
+ const parentNode2 = element.parentNode;
183
+ if (!parentNode2 || !(parentNode2 instanceof Element)) {
184
+ return "";
185
+ }
186
+ const siblings = Array.from(parentNode2.children).filter(
187
+ (sibling) => sibling.tagName === element.tagName
188
+ );
189
+ const index2 = siblings.length > 1 ? `[${siblings.indexOf(element) + 1}]` : "";
190
+ return `${getXPath(parentNode2)}/${element.tagName.toLowerCase()}${index2}`;
170
191
  }
171
- const parentNode2 = index$1.parentNode(n2);
172
- if (!parentNode2 || !(parentNode2 instanceof Element)) {
173
- return "";
192
+ if (node2.nodeType === Node.TEXT_NODE) {
193
+ const parent = node2.parentNode;
194
+ if (!parent) {
195
+ return "";
196
+ }
197
+ const textSiblings = Array.from(parent.childNodes).filter(
198
+ (sibling) => sibling.nodeType === Node.TEXT_NODE
199
+ );
200
+ const index2 = textSiblings.length > 1 ? `[${textSiblings.indexOf(node2) + 1}]` : "";
201
+ return `${getXPath(parent)}/text()${index2}`;
174
202
  }
175
- const siblings = Array.from(parentNode2.children).filter(
176
- (node2) => node2.tagName && node2.tagName === n2.tagName
177
- );
178
- const index$1$1 = siblings.length > 1 ? `[${siblings.indexOf(n2) + 1}]` : "";
179
- return getXPath(parentNode2) + "/" + n2.tagName.toLowerCase() + index$1$1;
203
+ if (node2.nodeType === Node.CDATA_SECTION_NODE) {
204
+ const parent = node2.parentNode;
205
+ if (!parent) {
206
+ return "";
207
+ }
208
+ const cdataSiblings = Array.from(parent.childNodes).filter(
209
+ (sibling) => sibling.nodeType === Node.CDATA_SECTION_NODE
210
+ );
211
+ const index2 = cdataSiblings.length > 1 ? `[${cdataSiblings.indexOf(node2) + 1}]` : "";
212
+ return `${getXPath(parent)}/text()${index2}`;
213
+ }
214
+ if (node2.nodeType === Node.COMMENT_NODE) {
215
+ const parent = node2.parentNode;
216
+ if (!parent) {
217
+ return "";
218
+ }
219
+ const commentSiblings = Array.from(parent.childNodes).filter(
220
+ (sibling) => sibling.nodeType === Node.COMMENT_NODE
221
+ );
222
+ const index2 = commentSiblings.length > 1 ? `[${commentSiblings.indexOf(node2) + 1}]` : "";
223
+ return `${getXPath(parent)}/comment()${index2}`;
224
+ }
225
+ return "";
180
226
  }
181
227
  function isElement(n2) {
182
228
  return n2.nodeType === n2.ELEMENT_NODE;
@@ -1945,7 +1991,7 @@ function cloneNode$1(obj, parent) {
1945
1991
  }
1946
1992
  return cloned;
1947
1993
  }
1948
- let Node$4$1 = class Node2 {
1994
+ let Node$5$1 = class Node2 {
1949
1995
  constructor(defaults = {}) {
1950
1996
  this.raws = {};
1951
1997
  this[isClean$2$1] = false;
@@ -2237,10 +2283,10 @@ let Node$4$1 = class Node2 {
2237
2283
  return this;
2238
2284
  }
2239
2285
  };
2240
- var node$1 = Node$4$1;
2241
- Node$4$1.default = Node$4$1;
2242
- let Node$3$1 = node$1;
2243
- let Declaration$4$1 = class Declaration extends Node$3$1 {
2286
+ var node$1 = Node$5$1;
2287
+ Node$5$1.default = Node$5$1;
2288
+ let Node$4$1 = node$1;
2289
+ let Declaration$4$1 = class Declaration extends Node$4$1 {
2244
2290
  constructor(defaults) {
2245
2291
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
2246
2292
  defaults = { ...defaults, value: String(defaults.value) };
@@ -2896,8 +2942,8 @@ let MapGenerator$2$1 = class MapGenerator {
2896
2942
  }
2897
2943
  };
2898
2944
  var mapGenerator$1 = MapGenerator$2$1;
2899
- let Node$2$1 = node$1;
2900
- let Comment$4$1 = class Comment extends Node$2$1 {
2945
+ let Node$3$1 = node$1;
2946
+ let Comment$4$1 = class Comment extends Node$3$1 {
2901
2947
  constructor(defaults) {
2902
2948
  super(defaults);
2903
2949
  this.type = "comment";
@@ -2908,7 +2954,7 @@ Comment$4$1.default = Comment$4$1;
2908
2954
  let { isClean: isClean$1$1, my: my$1$1 } = symbols$1;
2909
2955
  let Declaration$3$1 = declaration$1;
2910
2956
  let Comment$3$1 = comment$1;
2911
- let Node$1$1 = node$1;
2957
+ let Node$2$1 = node$1;
2912
2958
  let parse$4$1, Rule$4$1, AtRule$4$1, Root$6$1;
2913
2959
  function cleanSource$1(nodes) {
2914
2960
  return nodes.map((i2) => {
@@ -2925,7 +2971,7 @@ function markDirtyUp$1(node2) {
2925
2971
  }
2926
2972
  }
2927
2973
  }
2928
- let Container$7$1 = class Container extends Node$1$1 {
2974
+ let Container$7$1 = class Container extends Node$2$1 {
2929
2975
  append(...children) {
2930
2976
  for (let child of children) {
2931
2977
  let nodes = this.normalize(child, this.last);
@@ -4952,7 +4998,7 @@ let parse$5 = parse_1$1;
4952
4998
  let list$3 = list_1$1;
4953
4999
  let Rule2$1 = rule$1;
4954
5000
  let Root2$1 = root$1;
4955
- let Node2$1 = node$1;
5001
+ let Node$1$1 = node$1;
4956
5002
  function postcss$3(...plugins) {
4957
5003
  if (plugins.length === 1 && Array.isArray(plugins[0])) {
4958
5004
  plugins = plugins[0];
@@ -5012,7 +5058,7 @@ postcss$3.Result = Result2$1;
5012
5058
  postcss$3.Input = Input2$1;
5013
5059
  postcss$3.Rule = Rule2$1;
5014
5060
  postcss$3.Root = Root2$1;
5015
- postcss$3.Node = Node2$1;
5061
+ postcss$3.Node = Node$1$1;
5016
5062
  LazyResult2$1.registerPostcss(postcss$3);
5017
5063
  var postcss_1$1 = postcss$3;
5018
5064
  postcss$3.default = postcss$3;
@@ -5942,7 +5988,7 @@ function cloneNode(obj, parent) {
5942
5988
  }
5943
5989
  return cloned;
5944
5990
  }
5945
- let Node$4 = class Node3 {
5991
+ let Node$5 = class Node22 {
5946
5992
  constructor(defaults = {}) {
5947
5993
  this.raws = {};
5948
5994
  this[isClean$2] = false;
@@ -6234,10 +6280,10 @@ let Node$4 = class Node3 {
6234
6280
  return this;
6235
6281
  }
6236
6282
  };
6237
- var node = Node$4;
6238
- Node$4.default = Node$4;
6239
- let Node$3 = node;
6240
- let Declaration$4 = class Declaration2 extends Node$3 {
6283
+ var node = Node$5;
6284
+ Node$5.default = Node$5;
6285
+ let Node$4 = node;
6286
+ let Declaration$4 = class Declaration2 extends Node$4 {
6241
6287
  constructor(defaults) {
6242
6288
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
6243
6289
  defaults = { ...defaults, value: String(defaults.value) };
@@ -6893,8 +6939,8 @@ let MapGenerator$2 = class MapGenerator2 {
6893
6939
  }
6894
6940
  };
6895
6941
  var mapGenerator = MapGenerator$2;
6896
- let Node$2 = node;
6897
- let Comment$4 = class Comment2 extends Node$2 {
6942
+ let Node$3 = node;
6943
+ let Comment$4 = class Comment2 extends Node$3 {
6898
6944
  constructor(defaults) {
6899
6945
  super(defaults);
6900
6946
  this.type = "comment";
@@ -6905,7 +6951,7 @@ Comment$4.default = Comment$4;
6905
6951
  let { isClean: isClean$1, my: my$1 } = symbols;
6906
6952
  let Declaration$3 = declaration;
6907
6953
  let Comment$3 = comment;
6908
- let Node$1 = node;
6954
+ let Node$2 = node;
6909
6955
  let parse$4, Rule$4, AtRule$4, Root$6;
6910
6956
  function cleanSource(nodes) {
6911
6957
  return nodes.map((i2) => {
@@ -6922,7 +6968,7 @@ function markDirtyUp(node2) {
6922
6968
  }
6923
6969
  }
6924
6970
  }
6925
- let Container$7 = class Container2 extends Node$1 {
6971
+ let Container$7 = class Container2 extends Node$2 {
6926
6972
  append(...children) {
6927
6973
  for (let child of children) {
6928
6974
  let nodes = this.normalize(child, this.last);
@@ -8949,7 +8995,7 @@ let parse = parse_1;
8949
8995
  let list = list_1;
8950
8996
  let Rule22 = rule;
8951
8997
  let Root22 = root;
8952
- let Node22 = node;
8998
+ let Node$1 = node;
8953
8999
  function postcss(...plugins) {
8954
9000
  if (plugins.length === 1 && Array.isArray(plugins[0])) {
8955
9001
  plugins = plugins[0];
@@ -9009,7 +9055,7 @@ postcss.Result = Result22;
9009
9055
  postcss.Input = Input22;
9010
9056
  postcss.Rule = Rule22;
9011
9057
  postcss.Root = Root22;
9012
- postcss.Node = Node22;
9058
+ postcss.Node = Node$1;
9013
9059
  LazyResult22.registerPostcss(postcss);
9014
9060
  var postcss_1 = postcss;
9015
9061
  postcss.default = postcss;