From 808823639ff98ce2b573986c91599d0daec057dc Mon Sep 17 00:00:00 2001 From: Yanzhen Yu Date: Wed, 1 Apr 2026 12:00:00 +0800 Subject: [PATCH] fix lint warning --- packages/rrweb/src/record/mutation.ts | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/packages/rrweb/src/record/mutation.ts b/packages/rrweb/src/record/mutation.ts index 4ba50a54..be6fe19b 100644 --- a/packages/rrweb/src/record/mutation.ts +++ b/packages/rrweb/src/record/mutation.ts @@ -483,29 +483,27 @@ export default class MutationBuffer { old.setAttribute('style', m.oldValue); } if ( - item.attributes['style'] === undefined || - item.attributes['style'] === null + item.attributes.style === undefined || + item.attributes.style === null ) { - item.attributes['style'] = {}; + item.attributes.style = {}; } - const styleObj = item.attributes['style'] as styleAttributeValue; - for (let i = 0; i < target.style.length; i++) { - let pname = target.style[i]; + const styleObj = item.attributes.style as styleAttributeValue; + for (const pname of Array.from(target.style)) { const newValue = target.style.getPropertyValue(pname); const newPriority = target.style.getPropertyPriority(pname); if ( - newValue != old.style.getPropertyValue(pname) || - newPriority != old.style.getPropertyPriority(pname) + newValue !== old.style.getPropertyValue(pname) || + newPriority !== old.style.getPropertyPriority(pname) ) { - if (newPriority == '') { + if (newPriority === '') { styleObj[pname] = newValue; } else { styleObj[pname] = [newValue, newPriority]; } } } - for (let i = 0; i < old.style.length; i++) { - let pname = old.style[i]; + for (const pname of Array.from(old.style)) { if ( target.style.getPropertyValue(pname) === '' || !target.style.getPropertyValue(pname) // covering potential non-standard browsers