From cd1281663819259fa23c7ae606757ed802e25e5c Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Wed, 1 Apr 2026 12:00:00 +0800 Subject: [PATCH] close #140 transform mutated attributes --- package.json | 2 +- src/record/observer.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index fffe795f..d18ce023 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "dependencies": { "@types/smoothscroll-polyfill": "^0.3.0", "mitt": "^1.1.3", - "rrweb-snapshot": "^0.7.20", + "rrweb-snapshot": "^0.7.21", "smoothscroll-polyfill": "^0.4.3" } } diff --git a/src/record/observer.ts b/src/record/observer.ts index b282d1a9..a6b130f0 100644 --- a/src/record/observer.ts +++ b/src/record/observer.ts @@ -1,4 +1,4 @@ -import { INode, serializeNodeWithId } from 'rrweb-snapshot'; +import { INode, serializeNodeWithId, transformAttribute } from 'rrweb-snapshot'; import { mirror, throttle, @@ -130,7 +130,11 @@ function initMutationObserver( attributes.push(item); } // overwrite attribute if the mutations was triggered in same time - item.attributes[attributeName!] = value; + item.attributes[attributeName!] = transformAttribute( + document, + attributeName!, + value!, + ); break; } case 'childList': {