improve robustness of inlineImages feature (#812)

* fix: add inlineImages option to rrrweb recorder and try to make the code more robust

* Improve robustness
This commit is contained in:
Yun Feng
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 269b8bb216
commit 0153270680
3 changed files with 33 additions and 33 deletions

View File

@@ -227,10 +227,13 @@ function buildNode(
}
};
} else if (tagName === 'img' && name === 'rr_dataURL') {
const image = (node as HTMLImageElement);
const image = node as HTMLImageElement;
if (!image.currentSrc.startsWith('data:')) {
// backup original img src
image.setAttribute('data-rrweb-src', image.currentSrc);
// Backup original img src. It may not have been set yet.
image.setAttribute(
'rrweb-original-src',
n.attributes['src'] as string,
);
image.src = value;
}
image.removeAttribute(name);