format code

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 94d64e3424
commit 927f754a9d
2 changed files with 31 additions and 29 deletions

View File

@@ -99,7 +99,7 @@ function buildNode(
}
for (const name in n.attributes) {
if (!n.attributes.hasOwnProperty(name)) {
continue
continue;
}
let value = n.attributes[name];
value = typeof value === 'boolean' ? '' : value;
@@ -137,14 +137,14 @@ function buildNode(
} else {
// handle internal attributes
if (tagName === 'canvas' && name === 'rr_dataURL') {
const image = document.createElement('img')
image.src = value
const image = document.createElement('img');
image.src = value;
image.onload = () => {
const ctx = (node as HTMLCanvasElement).getContext('2d')
const ctx = (node as HTMLCanvasElement).getContext('2d');
if (ctx) {
ctx.drawImage(image, 0, 0, image.width, image.height)
ctx.drawImage(image, 0, 0, image.width, image.height);
}
}
};
}
if (name === 'rr_width') {
(node as HTMLElement).style.width = value;