@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.js CHANGED
@@ -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;
@@ -1941,7 +1989,7 @@ function cloneNode$1(obj, parent) {
1941
1989
  }
1942
1990
  return cloned;
1943
1991
  }
1944
- let Node$4$1 = class Node2 {
1992
+ let Node$5$1 = class Node2 {
1945
1993
  constructor(defaults = {}) {
1946
1994
  this.raws = {};
1947
1995
  this[isClean$2$1] = false;
@@ -2233,10 +2281,10 @@ let Node$4$1 = class Node2 {
2233
2281
  return this;
2234
2282
  }
2235
2283
  };
2236
- var node$1 = Node$4$1;
2237
- Node$4$1.default = Node$4$1;
2238
- let Node$3$1 = node$1;
2239
- let Declaration$4$1 = class Declaration extends Node$3$1 {
2284
+ var node$1 = Node$5$1;
2285
+ Node$5$1.default = Node$5$1;
2286
+ let Node$4$1 = node$1;
2287
+ let Declaration$4$1 = class Declaration extends Node$4$1 {
2240
2288
  constructor(defaults) {
2241
2289
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
2242
2290
  defaults = { ...defaults, value: String(defaults.value) };
@@ -2892,8 +2940,8 @@ let MapGenerator$2$1 = class MapGenerator {
2892
2940
  }
2893
2941
  };
2894
2942
  var mapGenerator$1 = MapGenerator$2$1;
2895
- let Node$2$1 = node$1;
2896
- let Comment$4$1 = class Comment extends Node$2$1 {
2943
+ let Node$3$1 = node$1;
2944
+ let Comment$4$1 = class Comment extends Node$3$1 {
2897
2945
  constructor(defaults) {
2898
2946
  super(defaults);
2899
2947
  this.type = "comment";
@@ -2904,7 +2952,7 @@ Comment$4$1.default = Comment$4$1;
2904
2952
  let { isClean: isClean$1$1, my: my$1$1 } = symbols$1;
2905
2953
  let Declaration$3$1 = declaration$1;
2906
2954
  let Comment$3$1 = comment$1;
2907
- let Node$1$1 = node$1;
2955
+ let Node$2$1 = node$1;
2908
2956
  let parse$4$1, Rule$4$1, AtRule$4$1, Root$6$1;
2909
2957
  function cleanSource$1(nodes) {
2910
2958
  return nodes.map((i2) => {
@@ -2921,7 +2969,7 @@ function markDirtyUp$1(node2) {
2921
2969
  }
2922
2970
  }
2923
2971
  }
2924
- let Container$7$1 = class Container extends Node$1$1 {
2972
+ let Container$7$1 = class Container extends Node$2$1 {
2925
2973
  append(...children) {
2926
2974
  for (let child of children) {
2927
2975
  let nodes = this.normalize(child, this.last);
@@ -4948,7 +4996,7 @@ let parse$5 = parse_1$1;
4948
4996
  let list$3 = list_1$1;
4949
4997
  let Rule2$1 = rule$1;
4950
4998
  let Root2$1 = root$1;
4951
- let Node2$1 = node$1;
4999
+ let Node$1$1 = node$1;
4952
5000
  function postcss$3(...plugins) {
4953
5001
  if (plugins.length === 1 && Array.isArray(plugins[0])) {
4954
5002
  plugins = plugins[0];
@@ -5008,7 +5056,7 @@ postcss$3.Result = Result2$1;
5008
5056
  postcss$3.Input = Input2$1;
5009
5057
  postcss$3.Rule = Rule2$1;
5010
5058
  postcss$3.Root = Root2$1;
5011
- postcss$3.Node = Node2$1;
5059
+ postcss$3.Node = Node$1$1;
5012
5060
  LazyResult2$1.registerPostcss(postcss$3);
5013
5061
  var postcss_1$1 = postcss$3;
5014
5062
  postcss$3.default = postcss$3;
@@ -5938,7 +5986,7 @@ function cloneNode(obj, parent) {
5938
5986
  }
5939
5987
  return cloned;
5940
5988
  }
5941
- let Node$4 = class Node3 {
5989
+ let Node$5 = class Node22 {
5942
5990
  constructor(defaults = {}) {
5943
5991
  this.raws = {};
5944
5992
  this[isClean$2] = false;
@@ -6230,10 +6278,10 @@ let Node$4 = class Node3 {
6230
6278
  return this;
6231
6279
  }
6232
6280
  };
6233
- var node = Node$4;
6234
- Node$4.default = Node$4;
6235
- let Node$3 = node;
6236
- let Declaration$4 = class Declaration2 extends Node$3 {
6281
+ var node = Node$5;
6282
+ Node$5.default = Node$5;
6283
+ let Node$4 = node;
6284
+ let Declaration$4 = class Declaration2 extends Node$4 {
6237
6285
  constructor(defaults) {
6238
6286
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
6239
6287
  defaults = { ...defaults, value: String(defaults.value) };
@@ -6889,8 +6937,8 @@ let MapGenerator$2 = class MapGenerator2 {
6889
6937
  }
6890
6938
  };
6891
6939
  var mapGenerator = MapGenerator$2;
6892
- let Node$2 = node;
6893
- let Comment$4 = class Comment2 extends Node$2 {
6940
+ let Node$3 = node;
6941
+ let Comment$4 = class Comment2 extends Node$3 {
6894
6942
  constructor(defaults) {
6895
6943
  super(defaults);
6896
6944
  this.type = "comment";
@@ -6901,7 +6949,7 @@ Comment$4.default = Comment$4;
6901
6949
  let { isClean: isClean$1, my: my$1 } = symbols;
6902
6950
  let Declaration$3 = declaration;
6903
6951
  let Comment$3 = comment;
6904
- let Node$1 = node;
6952
+ let Node$2 = node;
6905
6953
  let parse$4, Rule$4, AtRule$4, Root$6;
6906
6954
  function cleanSource(nodes) {
6907
6955
  return nodes.map((i2) => {
@@ -6918,7 +6966,7 @@ function markDirtyUp(node2) {
6918
6966
  }
6919
6967
  }
6920
6968
  }
6921
- let Container$7 = class Container2 extends Node$1 {
6969
+ let Container$7 = class Container2 extends Node$2 {
6922
6970
  append(...children) {
6923
6971
  for (let child of children) {
6924
6972
  let nodes = this.normalize(child, this.last);
@@ -8945,7 +8993,7 @@ let parse = parse_1;
8945
8993
  let list = list_1;
8946
8994
  let Rule22 = rule;
8947
8995
  let Root22 = root;
8948
- let Node22 = node;
8996
+ let Node$1 = node;
8949
8997
  function postcss(...plugins) {
8950
8998
  if (plugins.length === 1 && Array.isArray(plugins[0])) {
8951
8999
  plugins = plugins[0];
@@ -9005,7 +9053,7 @@ postcss.Result = Result22;
9005
9053
  postcss.Input = Input22;
9006
9054
  postcss.Rule = Rule22;
9007
9055
  postcss.Root = Root22;
9008
- postcss.Node = Node22;
9056
+ postcss.Node = Node$1;
9009
9057
  LazyResult22.registerPostcss(postcss);
9010
9058
  var postcss_1 = postcss;
9011
9059
  postcss.default = postcss;