diff --git a/src/record/mutation.ts b/src/record/mutation.ts index 2344265c27..b924fc9720 100644 --- a/src/record/mutation.ts +++ b/src/record/mutation.ts @@ -28,6 +28,7 @@ import { isIgnored, isIframeINode, hasShadowRoot, + styleAttributeValue, } from '../utils'; import { IframeManager } from './iframe-manager'; import { ShadowDomManager } from './shadow-dom-manager'; @@ -475,10 +476,14 @@ export default class MutationBuffer { } if (m.attributeName === 'style') { const old = this.doc.createElement('span'); - old.setAttribute('style', m.oldValue); - if (item.attributes['style'] === undefined) { + if (m.oldValue) { + old.setAttribute('style', m.oldValue); + } + if (item.attributes['style'] === undefined || + item.attributes['style'] === null) { item.attributes['style'] = {}; } + const styleObj = (item.attributes['style'] as styleAttributeValue); for (let i=0; i