close #350 catch error may caused by checkout feature

This commit is contained in:
Yanzhen Yu
2020-09-20 12:47:43 +08:00
parent 9a3e1fe724
commit 9049f2aef1

View File

@@ -977,11 +977,20 @@ export class Replayer {
for (const attributeName in mutation.attributes) { for (const attributeName in mutation.attributes) {
if (typeof attributeName === 'string') { if (typeof attributeName === 'string') {
const value = mutation.attributes[attributeName]; const value = mutation.attributes[attributeName];
try {
if (value !== null) { if (value !== null) {
((target as Node) as Element).setAttribute(attributeName, value); ((target as Node) as Element).setAttribute(attributeName, value);
} else { } else {
((target as Node) as Element).removeAttribute(attributeName); ((target as Node) as Element).removeAttribute(attributeName);
} }
} catch (error) {
if (this.config.showWarning) {
console.warn(
'An error occurred may due to the checkout feature.',
error,
);
}
}
} }
} }
}); });