fix lint warning

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 4b6efde134
commit 808823639f

View File

@@ -483,29 +483,27 @@ export default class MutationBuffer {
old.setAttribute('style', m.oldValue); old.setAttribute('style', m.oldValue);
} }
if ( if (
item.attributes['style'] === undefined || item.attributes.style === undefined ||
item.attributes['style'] === null item.attributes.style === null
) { ) {
item.attributes['style'] = {}; item.attributes.style = {};
} }
const styleObj = item.attributes['style'] as styleAttributeValue; const styleObj = item.attributes.style as styleAttributeValue;
for (let i = 0; i < target.style.length; i++) { for (const pname of Array.from(target.style)) {
let pname = target.style[i];
const newValue = target.style.getPropertyValue(pname); const newValue = target.style.getPropertyValue(pname);
const newPriority = target.style.getPropertyPriority(pname); const newPriority = target.style.getPropertyPriority(pname);
if ( if (
newValue != old.style.getPropertyValue(pname) || newValue !== old.style.getPropertyValue(pname) ||
newPriority != old.style.getPropertyPriority(pname) newPriority !== old.style.getPropertyPriority(pname)
) { ) {
if (newPriority == '') { if (newPriority === '') {
styleObj[pname] = newValue; styleObj[pname] = newValue;
} else { } else {
styleObj[pname] = [newValue, newPriority]; styleObj[pname] = [newValue, newPriority];
} }
} }
} }
for (let i = 0; i < old.style.length; i++) { for (const pname of Array.from(old.style)) {
let pname = old.style[i];
if ( if (
target.style.getPropertyValue(pname) === '' || target.style.getPropertyValue(pname) === '' ||
!target.style.getPropertyValue(pname) // covering potential non-standard browsers !target.style.getPropertyValue(pname) // covering potential non-standard browsers