@appsurify-testmap/rrweb 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.
package/dist/rrweb.cjs CHANGED
@@ -158,23 +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
- const parentNode2 = index$1.parentNode(n2);
169
- if (!parentNode2 || !(parentNode2 instanceof Element)) {
170
- 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}`;
171
191
  }
172
- const siblings = Array.from(parentNode2.children).filter(
173
- (node2) => node2.tagName === n2.tagName
174
- );
175
- const index$1$1 = siblings.length > 1 ? `[${siblings.indexOf(n2) + 1}]` : "";
176
- const path = getXPath(parentNode2) + "/" + n2.tagName.toLowerCase() + index$1$1;
177
- return path;
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}`;
202
+ }
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 "";
178
226
  }
179
227
  function isElement(n2) {
180
228
  return n2.nodeType === n2.ELEMENT_NODE;
@@ -1943,7 +1991,7 @@ function cloneNode$1(obj, parent) {
1943
1991
  }
1944
1992
  return cloned;
1945
1993
  }
1946
- let Node$4$1 = class Node2 {
1994
+ let Node$5$1 = class Node2 {
1947
1995
  constructor(defaults = {}) {
1948
1996
  this.raws = {};
1949
1997
  this[isClean$2$1] = false;
@@ -2235,10 +2283,10 @@ let Node$4$1 = class Node2 {
2235
2283
  return this;
2236
2284
  }
2237
2285
  };
2238
- var node$1 = Node$4$1;
2239
- Node$4$1.default = Node$4$1;
2240
- let Node$3$1 = node$1;
2241
- 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 {
2242
2290
  constructor(defaults) {
2243
2291
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
2244
2292
  defaults = { ...defaults, value: String(defaults.value) };
@@ -2894,8 +2942,8 @@ let MapGenerator$2$1 = class MapGenerator {
2894
2942
  }
2895
2943
  };
2896
2944
  var mapGenerator$1 = MapGenerator$2$1;
2897
- let Node$2$1 = node$1;
2898
- 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 {
2899
2947
  constructor(defaults) {
2900
2948
  super(defaults);
2901
2949
  this.type = "comment";
@@ -2906,7 +2954,7 @@ Comment$4$1.default = Comment$4$1;
2906
2954
  let { isClean: isClean$1$1, my: my$1$1 } = symbols$1;
2907
2955
  let Declaration$3$1 = declaration$1;
2908
2956
  let Comment$3$1 = comment$1;
2909
- let Node$1$1 = node$1;
2957
+ let Node$2$1 = node$1;
2910
2958
  let parse$4$1, Rule$4$1, AtRule$4$1, Root$6$1;
2911
2959
  function cleanSource$1(nodes) {
2912
2960
  return nodes.map((i2) => {
@@ -2923,7 +2971,7 @@ function markDirtyUp$1(node2) {
2923
2971
  }
2924
2972
  }
2925
2973
  }
2926
- let Container$7$1 = class Container extends Node$1$1 {
2974
+ let Container$7$1 = class Container extends Node$2$1 {
2927
2975
  append(...children) {
2928
2976
  for (let child of children) {
2929
2977
  let nodes = this.normalize(child, this.last);
@@ -4950,7 +4998,7 @@ let parse$5 = parse_1$1;
4950
4998
  let list$3 = list_1$1;
4951
4999
  let Rule2$1 = rule$1;
4952
5000
  let Root2$1 = root$1;
4953
- let Node2$1 = node$1;
5001
+ let Node$1$1 = node$1;
4954
5002
  function postcss$3(...plugins) {
4955
5003
  if (plugins.length === 1 && Array.isArray(plugins[0])) {
4956
5004
  plugins = plugins[0];
@@ -5010,7 +5058,7 @@ postcss$3.Result = Result2$1;
5010
5058
  postcss$3.Input = Input2$1;
5011
5059
  postcss$3.Rule = Rule2$1;
5012
5060
  postcss$3.Root = Root2$1;
5013
- postcss$3.Node = Node2$1;
5061
+ postcss$3.Node = Node$1$1;
5014
5062
  LazyResult2$1.registerPostcss(postcss$3);
5015
5063
  var postcss_1$1 = postcss$3;
5016
5064
  postcss$3.default = postcss$3;
@@ -5940,7 +5988,7 @@ function cloneNode(obj, parent) {
5940
5988
  }
5941
5989
  return cloned;
5942
5990
  }
5943
- let Node$4 = class Node3 {
5991
+ let Node$5 = class Node22 {
5944
5992
  constructor(defaults = {}) {
5945
5993
  this.raws = {};
5946
5994
  this[isClean$2] = false;
@@ -6232,10 +6280,10 @@ let Node$4 = class Node3 {
6232
6280
  return this;
6233
6281
  }
6234
6282
  };
6235
- var node = Node$4;
6236
- Node$4.default = Node$4;
6237
- let Node$3 = node;
6238
- 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 {
6239
6287
  constructor(defaults) {
6240
6288
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
6241
6289
  defaults = { ...defaults, value: String(defaults.value) };
@@ -6891,8 +6939,8 @@ let MapGenerator$2 = class MapGenerator2 {
6891
6939
  }
6892
6940
  };
6893
6941
  var mapGenerator = MapGenerator$2;
6894
- let Node$2 = node;
6895
- let Comment$4 = class Comment2 extends Node$2 {
6942
+ let Node$3 = node;
6943
+ let Comment$4 = class Comment2 extends Node$3 {
6896
6944
  constructor(defaults) {
6897
6945
  super(defaults);
6898
6946
  this.type = "comment";
@@ -6903,7 +6951,7 @@ Comment$4.default = Comment$4;
6903
6951
  let { isClean: isClean$1, my: my$1 } = symbols;
6904
6952
  let Declaration$3 = declaration;
6905
6953
  let Comment$3 = comment;
6906
- let Node$1 = node;
6954
+ let Node$2 = node;
6907
6955
  let parse$4, Rule$4, AtRule$4, Root$6;
6908
6956
  function cleanSource(nodes) {
6909
6957
  return nodes.map((i2) => {
@@ -6920,7 +6968,7 @@ function markDirtyUp(node2) {
6920
6968
  }
6921
6969
  }
6922
6970
  }
6923
- let Container$7 = class Container2 extends Node$1 {
6971
+ let Container$7 = class Container2 extends Node$2 {
6924
6972
  append(...children) {
6925
6973
  for (let child of children) {
6926
6974
  let nodes = this.normalize(child, this.last);
@@ -8947,7 +8995,7 @@ let parse = parse_1;
8947
8995
  let list = list_1;
8948
8996
  let Rule22 = rule;
8949
8997
  let Root22 = root;
8950
- let Node22 = node;
8998
+ let Node$1 = node;
8951
8999
  function postcss(...plugins) {
8952
9000
  if (plugins.length === 1 && Array.isArray(plugins[0])) {
8953
9001
  plugins = plugins[0];
@@ -9007,7 +9055,7 @@ postcss.Result = Result22;
9007
9055
  postcss.Input = Input22;
9008
9056
  postcss.Rule = Rule22;
9009
9057
  postcss.Root = Root22;
9010
- postcss.Node = Node22;
9058
+ postcss.Node = Node$1;
9011
9059
  LazyResult22.registerPostcss(postcss);
9012
9060
  var postcss_1 = postcss;
9013
9061
  postcss.default = postcss;