@appsurify-testmap/rrweb-snapshot 2.1.0-alpha.2 → 2.1.0-alpha.5
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/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/rrweb-snapshot.cjs +45 -32
- package/dist/rrweb-snapshot.cjs.map +1 -1
- package/dist/rrweb-snapshot.js +45 -32
- package/dist/rrweb-snapshot.js.map +1 -1
- package/dist/rrweb-snapshot.umd.cjs +45 -32
- package/dist/rrweb-snapshot.umd.cjs.map +2 -2
- package/dist/rrweb-snapshot.umd.min.cjs +13 -13
- package/dist/rrweb-snapshot.umd.min.cjs.map +3 -3
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -60,6 +60,8 @@ export declare interface ICanvas extends HTMLCanvasElement {
|
|
|
60
60
|
|
|
61
61
|
export declare type idNodeMap = Map<number, Node>;
|
|
62
62
|
|
|
63
|
+
export declare function ignoreAttribute(tagName: string, name: string, _value: unknown): boolean;
|
|
64
|
+
|
|
63
65
|
export declare const IGNORED_NODE = -2;
|
|
64
66
|
|
|
65
67
|
export declare const interactiveEvents: string[];
|
|
@@ -78,7 +80,9 @@ export declare function isElementInteractive(n: Node): boolean;
|
|
|
78
80
|
|
|
79
81
|
export declare function isElementVisible(n: Element): boolean;
|
|
80
82
|
|
|
81
|
-
export declare function
|
|
83
|
+
export declare function isExcludeAttribute(name: string, exclude: string | RegExp): boolean;
|
|
84
|
+
|
|
85
|
+
export declare function isIncludeAttribute(name: string, include: string | RegExp): boolean;
|
|
82
86
|
|
|
83
87
|
export declare function isNativeShadowDom(shadowRoot: ShadowRoot): boolean;
|
|
84
88
|
|
|
@@ -161,7 +165,8 @@ export declare function serializeNodeWithId(n: Node, options: {
|
|
|
161
165
|
blockSelector: string | null;
|
|
162
166
|
maskTextClass: string | RegExp;
|
|
163
167
|
maskTextSelector: string | null;
|
|
164
|
-
|
|
168
|
+
excludeAttribute: string | RegExp;
|
|
169
|
+
includeAttribute: string | RegExp;
|
|
165
170
|
skipChild: boolean;
|
|
166
171
|
inlineStylesheet: boolean;
|
|
167
172
|
newlyAddedElement?: boolean;
|
|
@@ -203,7 +208,8 @@ export declare function snapshot(n: Document, options?: {
|
|
|
203
208
|
blockSelector?: string | null;
|
|
204
209
|
maskTextClass?: string | RegExp;
|
|
205
210
|
maskTextSelector?: string | null;
|
|
206
|
-
|
|
211
|
+
excludeAttribute?: string | RegExp;
|
|
212
|
+
includeAttribute?: string | RegExp;
|
|
207
213
|
inlineStylesheet?: boolean;
|
|
208
214
|
maskAllInputs?: boolean | MaskInputOptions;
|
|
209
215
|
maskTextFn?: MaskTextFn;
|
package/dist/index.d.ts
CHANGED
|
@@ -60,6 +60,8 @@ export declare interface ICanvas extends HTMLCanvasElement {
|
|
|
60
60
|
|
|
61
61
|
export declare type idNodeMap = Map<number, Node>;
|
|
62
62
|
|
|
63
|
+
export declare function ignoreAttribute(tagName: string, name: string, _value: unknown): boolean;
|
|
64
|
+
|
|
63
65
|
export declare const IGNORED_NODE = -2;
|
|
64
66
|
|
|
65
67
|
export declare const interactiveEvents: string[];
|
|
@@ -78,7 +80,9 @@ export declare function isElementInteractive(n: Node): boolean;
|
|
|
78
80
|
|
|
79
81
|
export declare function isElementVisible(n: Element): boolean;
|
|
80
82
|
|
|
81
|
-
export declare function
|
|
83
|
+
export declare function isExcludeAttribute(name: string, exclude: string | RegExp): boolean;
|
|
84
|
+
|
|
85
|
+
export declare function isIncludeAttribute(name: string, include: string | RegExp): boolean;
|
|
82
86
|
|
|
83
87
|
export declare function isNativeShadowDom(shadowRoot: ShadowRoot): boolean;
|
|
84
88
|
|
|
@@ -161,7 +165,8 @@ export declare function serializeNodeWithId(n: Node, options: {
|
|
|
161
165
|
blockSelector: string | null;
|
|
162
166
|
maskTextClass: string | RegExp;
|
|
163
167
|
maskTextSelector: string | null;
|
|
164
|
-
|
|
168
|
+
excludeAttribute: string | RegExp;
|
|
169
|
+
includeAttribute: string | RegExp;
|
|
165
170
|
skipChild: boolean;
|
|
166
171
|
inlineStylesheet: boolean;
|
|
167
172
|
newlyAddedElement?: boolean;
|
|
@@ -203,7 +208,8 @@ export declare function snapshot(n: Document, options?: {
|
|
|
203
208
|
blockSelector?: string | null;
|
|
204
209
|
maskTextClass?: string | RegExp;
|
|
205
210
|
maskTextSelector?: string | null;
|
|
206
|
-
|
|
211
|
+
excludeAttribute?: string | RegExp;
|
|
212
|
+
includeAttribute?: string | RegExp;
|
|
207
213
|
inlineStylesheet?: boolean;
|
|
208
214
|
maskAllInputs?: boolean | MaskInputOptions;
|
|
209
215
|
maskTextFn?: MaskTextFn;
|
package/dist/rrweb-snapshot.cjs
CHANGED
|
@@ -888,28 +888,14 @@ function transformAttribute(doc, tagName, name, value) {
|
|
|
888
888
|
}
|
|
889
889
|
return value;
|
|
890
890
|
}
|
|
891
|
-
function
|
|
891
|
+
function ignoreAttribute(tagName, name, _value) {
|
|
892
892
|
return (tagName === "video" || tagName === "audio") && name === "autoplay";
|
|
893
893
|
}
|
|
894
|
-
function
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
const attr = element.attributes[i];
|
|
900
|
-
const name = attr.name;
|
|
901
|
-
const value = attr.value;
|
|
902
|
-
const shouldIgnoreByName = typeof ignoreAttribute === "string" ? name === ignoreAttribute : ignoreAttribute.test(name);
|
|
903
|
-
if (!shouldIgnoreByName && !isIgnoreAttribute(tagName, name)) {
|
|
904
|
-
attributes[name] = transformAttribute(
|
|
905
|
-
doc,
|
|
906
|
-
tagName,
|
|
907
|
-
toLowerCase(name),
|
|
908
|
-
value
|
|
909
|
-
);
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
return attributes;
|
|
894
|
+
function isIncludeAttribute(name, include) {
|
|
895
|
+
return typeof include === "string" ? name.includes(include) : include.test(name);
|
|
896
|
+
}
|
|
897
|
+
function isExcludeAttribute(name, exclude) {
|
|
898
|
+
return typeof exclude === "string" ? name.includes(exclude) : exclude.test(name);
|
|
913
899
|
}
|
|
914
900
|
function _isBlockedElement(element, blockClass, blockSelector) {
|
|
915
901
|
try {
|
|
@@ -1040,7 +1026,8 @@ function serializeNode(n, options) {
|
|
|
1040
1026
|
mirror,
|
|
1041
1027
|
blockClass,
|
|
1042
1028
|
blockSelector,
|
|
1043
|
-
|
|
1029
|
+
excludeAttribute,
|
|
1030
|
+
includeAttribute,
|
|
1044
1031
|
needsMask,
|
|
1045
1032
|
inlineStylesheet,
|
|
1046
1033
|
maskInputOptions = {},
|
|
@@ -1086,7 +1073,8 @@ function serializeNode(n, options) {
|
|
|
1086
1073
|
doc,
|
|
1087
1074
|
blockClass,
|
|
1088
1075
|
blockSelector,
|
|
1089
|
-
|
|
1076
|
+
excludeAttribute,
|
|
1077
|
+
includeAttribute,
|
|
1090
1078
|
inlineStylesheet,
|
|
1091
1079
|
maskInputOptions,
|
|
1092
1080
|
maskInputFn,
|
|
@@ -1164,7 +1152,8 @@ function serializeElementNode(n, options) {
|
|
|
1164
1152
|
doc,
|
|
1165
1153
|
blockClass,
|
|
1166
1154
|
blockSelector,
|
|
1167
|
-
|
|
1155
|
+
excludeAttribute,
|
|
1156
|
+
includeAttribute,
|
|
1168
1157
|
inlineStylesheet,
|
|
1169
1158
|
maskInputOptions = {},
|
|
1170
1159
|
maskInputFn,
|
|
@@ -1178,7 +1167,22 @@ function serializeElementNode(n, options) {
|
|
|
1178
1167
|
} = options;
|
|
1179
1168
|
const needBlock = _isBlockedElement(n, blockClass, blockSelector);
|
|
1180
1169
|
const tagName = getValidTagName(n);
|
|
1181
|
-
let attributes =
|
|
1170
|
+
let attributes = {};
|
|
1171
|
+
const len = n.attributes.length;
|
|
1172
|
+
for (let i = 0; i < len; i++) {
|
|
1173
|
+
const attr = n.attributes[i];
|
|
1174
|
+
if (isExcludeAttribute(attr.name, excludeAttribute) && !isIncludeAttribute(attr.name, includeAttribute)) {
|
|
1175
|
+
continue;
|
|
1176
|
+
}
|
|
1177
|
+
if (!ignoreAttribute(tagName, attr.name, attr.value)) {
|
|
1178
|
+
attributes[attr.name] = transformAttribute(
|
|
1179
|
+
doc,
|
|
1180
|
+
tagName,
|
|
1181
|
+
toLowerCase(attr.name),
|
|
1182
|
+
attr.value
|
|
1183
|
+
);
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1182
1186
|
if (tagName === "link" && inlineStylesheet) {
|
|
1183
1187
|
const stylesheet = Array.from(doc.styleSheets).find((s) => {
|
|
1184
1188
|
return s.href === n.href;
|
|
@@ -1392,7 +1396,8 @@ function serializeNodeWithId(n, options) {
|
|
|
1392
1396
|
blockSelector,
|
|
1393
1397
|
maskTextClass,
|
|
1394
1398
|
maskTextSelector,
|
|
1395
|
-
|
|
1399
|
+
excludeAttribute,
|
|
1400
|
+
includeAttribute,
|
|
1396
1401
|
skipChild = false,
|
|
1397
1402
|
inlineStylesheet = true,
|
|
1398
1403
|
maskInputOptions = {},
|
|
@@ -1427,7 +1432,8 @@ function serializeNodeWithId(n, options) {
|
|
|
1427
1432
|
mirror,
|
|
1428
1433
|
blockClass,
|
|
1429
1434
|
blockSelector,
|
|
1430
|
-
|
|
1435
|
+
excludeAttribute,
|
|
1436
|
+
includeAttribute,
|
|
1431
1437
|
needsMask,
|
|
1432
1438
|
inlineStylesheet,
|
|
1433
1439
|
maskInputOptions,
|
|
@@ -1480,7 +1486,8 @@ function serializeNodeWithId(n, options) {
|
|
|
1480
1486
|
needsMask,
|
|
1481
1487
|
maskTextClass,
|
|
1482
1488
|
maskTextSelector,
|
|
1483
|
-
|
|
1489
|
+
excludeAttribute,
|
|
1490
|
+
includeAttribute,
|
|
1484
1491
|
skipChild,
|
|
1485
1492
|
inlineStylesheet,
|
|
1486
1493
|
maskInputOptions,
|
|
@@ -1540,7 +1547,8 @@ function serializeNodeWithId(n, options) {
|
|
|
1540
1547
|
needsMask,
|
|
1541
1548
|
maskTextClass,
|
|
1542
1549
|
maskTextSelector,
|
|
1543
|
-
|
|
1550
|
+
excludeAttribute,
|
|
1551
|
+
includeAttribute,
|
|
1544
1552
|
skipChild: false,
|
|
1545
1553
|
inlineStylesheet,
|
|
1546
1554
|
maskInputOptions,
|
|
@@ -1582,7 +1590,8 @@ function serializeNodeWithId(n, options) {
|
|
|
1582
1590
|
needsMask,
|
|
1583
1591
|
maskTextClass,
|
|
1584
1592
|
maskTextSelector,
|
|
1585
|
-
|
|
1593
|
+
excludeAttribute,
|
|
1594
|
+
includeAttribute,
|
|
1586
1595
|
skipChild: false,
|
|
1587
1596
|
inlineStylesheet,
|
|
1588
1597
|
maskInputOptions,
|
|
@@ -1620,7 +1629,8 @@ function snapshot(n, options) {
|
|
|
1620
1629
|
blockSelector = null,
|
|
1621
1630
|
maskTextClass = "rr-mask",
|
|
1622
1631
|
maskTextSelector = null,
|
|
1623
|
-
|
|
1632
|
+
excludeAttribute = /^$a/,
|
|
1633
|
+
includeAttribute = /.+/i,
|
|
1624
1634
|
inlineStylesheet = true,
|
|
1625
1635
|
inlineImages = false,
|
|
1626
1636
|
recordCanvas = false,
|
|
@@ -1680,7 +1690,8 @@ function snapshot(n, options) {
|
|
|
1680
1690
|
blockSelector,
|
|
1681
1691
|
maskTextClass,
|
|
1682
1692
|
maskTextSelector,
|
|
1683
|
-
|
|
1693
|
+
excludeAttribute,
|
|
1694
|
+
includeAttribute,
|
|
1684
1695
|
skipChild: false,
|
|
1685
1696
|
inlineStylesheet,
|
|
1686
1697
|
maskInputOptions,
|
|
@@ -5727,6 +5738,7 @@ exports.fixSafariColons = fixSafariColons;
|
|
|
5727
5738
|
exports.genId = genId;
|
|
5728
5739
|
exports.getInputType = getInputType;
|
|
5729
5740
|
exports.getXPath = getXPath;
|
|
5741
|
+
exports.ignoreAttribute = ignoreAttribute;
|
|
5730
5742
|
exports.interactiveEvents = interactiveEvents;
|
|
5731
5743
|
exports.interactiveTags = interactiveTags;
|
|
5732
5744
|
exports.is2DCanvasBlank = is2DCanvasBlank;
|
|
@@ -5735,7 +5747,8 @@ exports.isCSSStyleRule = isCSSStyleRule;
|
|
|
5735
5747
|
exports.isElement = isElement;
|
|
5736
5748
|
exports.isElementInteractive = isElementInteractive;
|
|
5737
5749
|
exports.isElementVisible = isElementVisible;
|
|
5738
|
-
exports.
|
|
5750
|
+
exports.isExcludeAttribute = isExcludeAttribute;
|
|
5751
|
+
exports.isIncludeAttribute = isIncludeAttribute;
|
|
5739
5752
|
exports.isNativeShadowDom = isNativeShadowDom;
|
|
5740
5753
|
exports.isNodeMetaEqual = isNodeMetaEqual;
|
|
5741
5754
|
exports.isShadowRoot = isShadowRoot;
|