@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.js CHANGED
@@ -156,25 +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
- if (!n2.tagName) {
167
- 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}`;
168
189
  }
169
- const parentNode2 = index$1.parentNode(n2);
170
- if (!parentNode2 || !(parentNode2 instanceof Element)) {
171
- return "";
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}`;
172
200
  }
173
- const siblings = Array.from(parentNode2.children).filter(
174
- (node2) => node2.tagName && node2.tagName === n2.tagName
175
- );
176
- const index$1$1 = siblings.length > 1 ? `[${siblings.indexOf(n2) + 1}]` : "";
177
- return getXPath(parentNode2) + "/" + n2.tagName.toLowerCase() + index$1$1;
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 "";
178
224
  }
179
225
  function isElement(n2) {
180
226
  return n2.nodeType === n2.ELEMENT_NODE;
@@ -1943,7 +1989,7 @@ function cloneNode$1(obj, parent) {
1943
1989
  }
1944
1990
  return cloned;
1945
1991
  }
1946
- let Node$4$1 = class Node2 {
1992
+ let Node$5$1 = class Node2 {
1947
1993
  constructor(defaults = {}) {
1948
1994
  this.raws = {};
1949
1995
  this[isClean$2$1] = false;
@@ -2235,10 +2281,10 @@ let Node$4$1 = class Node2 {
2235
2281
  return this;
2236
2282
  }
2237
2283
  };
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 {
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 {
2242
2288
  constructor(defaults) {
2243
2289
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
2244
2290
  defaults = { ...defaults, value: String(defaults.value) };
@@ -2894,8 +2940,8 @@ let MapGenerator$2$1 = class MapGenerator {
2894
2940
  }
2895
2941
  };
2896
2942
  var mapGenerator$1 = MapGenerator$2$1;
2897
- let Node$2$1 = node$1;
2898
- 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 {
2899
2945
  constructor(defaults) {
2900
2946
  super(defaults);
2901
2947
  this.type = "comment";
@@ -2906,7 +2952,7 @@ Comment$4$1.default = Comment$4$1;
2906
2952
  let { isClean: isClean$1$1, my: my$1$1 } = symbols$1;
2907
2953
  let Declaration$3$1 = declaration$1;
2908
2954
  let Comment$3$1 = comment$1;
2909
- let Node$1$1 = node$1;
2955
+ let Node$2$1 = node$1;
2910
2956
  let parse$4$1, Rule$4$1, AtRule$4$1, Root$6$1;
2911
2957
  function cleanSource$1(nodes) {
2912
2958
  return nodes.map((i2) => {
@@ -2923,7 +2969,7 @@ function markDirtyUp$1(node2) {
2923
2969
  }
2924
2970
  }
2925
2971
  }
2926
- let Container$7$1 = class Container extends Node$1$1 {
2972
+ let Container$7$1 = class Container extends Node$2$1 {
2927
2973
  append(...children) {
2928
2974
  for (let child of children) {
2929
2975
  let nodes = this.normalize(child, this.last);
@@ -4950,7 +4996,7 @@ let parse$5 = parse_1$1;
4950
4996
  let list$3 = list_1$1;
4951
4997
  let Rule2$1 = rule$1;
4952
4998
  let Root2$1 = root$1;
4953
- let Node2$1 = node$1;
4999
+ let Node$1$1 = node$1;
4954
5000
  function postcss$3(...plugins) {
4955
5001
  if (plugins.length === 1 && Array.isArray(plugins[0])) {
4956
5002
  plugins = plugins[0];
@@ -5010,7 +5056,7 @@ postcss$3.Result = Result2$1;
5010
5056
  postcss$3.Input = Input2$1;
5011
5057
  postcss$3.Rule = Rule2$1;
5012
5058
  postcss$3.Root = Root2$1;
5013
- postcss$3.Node = Node2$1;
5059
+ postcss$3.Node = Node$1$1;
5014
5060
  LazyResult2$1.registerPostcss(postcss$3);
5015
5061
  var postcss_1$1 = postcss$3;
5016
5062
  postcss$3.default = postcss$3;
@@ -5940,7 +5986,7 @@ function cloneNode(obj, parent) {
5940
5986
  }
5941
5987
  return cloned;
5942
5988
  }
5943
- let Node$4 = class Node3 {
5989
+ let Node$5 = class Node22 {
5944
5990
  constructor(defaults = {}) {
5945
5991
  this.raws = {};
5946
5992
  this[isClean$2] = false;
@@ -6232,10 +6278,10 @@ let Node$4 = class Node3 {
6232
6278
  return this;
6233
6279
  }
6234
6280
  };
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 {
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 {
6239
6285
  constructor(defaults) {
6240
6286
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
6241
6287
  defaults = { ...defaults, value: String(defaults.value) };
@@ -6891,8 +6937,8 @@ let MapGenerator$2 = class MapGenerator2 {
6891
6937
  }
6892
6938
  };
6893
6939
  var mapGenerator = MapGenerator$2;
6894
- let Node$2 = node;
6895
- let Comment$4 = class Comment2 extends Node$2 {
6940
+ let Node$3 = node;
6941
+ let Comment$4 = class Comment2 extends Node$3 {
6896
6942
  constructor(defaults) {
6897
6943
  super(defaults);
6898
6944
  this.type = "comment";
@@ -6903,7 +6949,7 @@ Comment$4.default = Comment$4;
6903
6949
  let { isClean: isClean$1, my: my$1 } = symbols;
6904
6950
  let Declaration$3 = declaration;
6905
6951
  let Comment$3 = comment;
6906
- let Node$1 = node;
6952
+ let Node$2 = node;
6907
6953
  let parse$4, Rule$4, AtRule$4, Root$6;
6908
6954
  function cleanSource(nodes) {
6909
6955
  return nodes.map((i2) => {
@@ -6920,7 +6966,7 @@ function markDirtyUp(node2) {
6920
6966
  }
6921
6967
  }
6922
6968
  }
6923
- let Container$7 = class Container2 extends Node$1 {
6969
+ let Container$7 = class Container2 extends Node$2 {
6924
6970
  append(...children) {
6925
6971
  for (let child of children) {
6926
6972
  let nodes = this.normalize(child, this.last);
@@ -8947,7 +8993,7 @@ let parse = parse_1;
8947
8993
  let list = list_1;
8948
8994
  let Rule22 = rule;
8949
8995
  let Root22 = root;
8950
- let Node22 = node;
8996
+ let Node$1 = node;
8951
8997
  function postcss(...plugins) {
8952
8998
  if (plugins.length === 1 && Array.isArray(plugins[0])) {
8953
8999
  plugins = plugins[0];
@@ -9007,7 +9053,7 @@ postcss.Result = Result22;
9007
9053
  postcss.Input = Input22;
9008
9054
  postcss.Rule = Rule22;
9009
9055
  postcss.Root = Root22;
9010
- postcss.Node = Node22;
9056
+ postcss.Node = Node$1;
9011
9057
  LazyResult22.registerPostcss(postcss);
9012
9058
  var postcss_1 = postcss;
9013
9059
  postcss.default = postcss;