remove child node before set default value

This commit is contained in:
Yanzhen Yu
2019-08-07 23:38:09 +08:00
parent e48d50a718
commit ada77fe861

View File

@@ -106,6 +106,12 @@ function buildNode(n: serializedNodeWithId, doc: Document): Node | null {
}
if (isTextarea || isRemoteOrDynamicCss) {
const child = doc.createTextNode(value);
// https://github.com/rrweb-io/rrweb/issues/112
for (const c of Array.from(node.childNodes)) {
if (c.nodeType === node.TEXT_NODE) {
node.removeChild(c);
}
}
node.appendChild(child);
continue;
}