diff --git a/src/core/annotation.js b/src/core/annotation.js index 6948ddf2f..e297a4c61 100644 --- a/src/core/annotation.js +++ b/src/core/annotation.js @@ -4792,19 +4792,19 @@ class InkAnnotation extends MarkupAnnotation { if (!Array.isArray(rawInkLists)) { return; } - for (let i = 0, ii = rawInkLists.length; i < ii; ++i) { + for (const rawInkList of rawInkLists) { // The raw ink lists array contains arrays of numbers representing // the alternating horizontal and vertical coordinates, respectively, // of each vertex. Convert this to an array of objects with x and y // coordinates. - if (!Array.isArray(rawInkLists[i])) { + if (!Array.isArray(rawInkList)) { continue; } - const inkList = new Float32Array(rawInkLists[i].length); + const inkList = new Float32Array(rawInkList.length); this.data.inkLists.push(inkList); - for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) { - const x = xref.fetchIfRef(rawInkLists[i][j]), - y = xref.fetchIfRef(rawInkLists[i][j + 1]); + for (let j = 0, jj = rawInkList.length; j < jj; j += 2) { + const x = xref.fetchIfRef(rawInkList[j]), + y = xref.fetchIfRef(rawInkList[j + 1]); if (typeof x === "number" && typeof y === "number") { inkList[j] = x; inkList[j + 1] = y; diff --git a/src/core/editor/pdf_images.js b/src/core/editor/pdf_images.js index f98ed183f..7ff05b9ca 100644 --- a/src/core/editor/pdf_images.js +++ b/src/core/editor/pdf_images.js @@ -200,8 +200,7 @@ async function createImage(bitmap, xref, { closeBitmap = false } = {}) { const colorCounter = new Set(); let hasAlpha = false; let useFlate = true; - for (let i = 0, ii = buf32.length; i < ii; i++) { - const v = buf32[i]; + for (const v of buf32) { if ((isLE ? v >>> 24 : v & 0xff) !== 0xff) { hasAlpha = true; break; diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 97736b6c0..e0cb73d01 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -3273,9 +3273,7 @@ class PartialEvaluator { const spaceFactor = ((textState.font.vertical ? 1 : -1) * textState.fontSize) / 1000; - const elements = args[0]; - for (let i = 0, ii = elements.length; i < ii; i++) { - const item = elements[i]; + for (const item of args[0]) { if (typeof item === "string") { showSpacedTextBuffer.push(item); } else if (typeof item === "number" && item !== 0) { diff --git a/src/core/fonts.js b/src/core/fonts.js index 9ec554b7b..6f8ce007e 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -1525,9 +1525,9 @@ class Font { } const [nameTable] = readNameTable(potentialTables.name); - for (let j = 0, jj = nameTable.length; j < jj; j++) { - for (let k = 0, kk = nameTable[j].length; k < kk; k++) { - const nameEntry = nameTable[j][k]?.replaceAll(/\s/g, ""); + for (const nameArr of nameTable) { + for (const entry of nameArr) { + const nameEntry = entry?.replaceAll(/\s/g, ""); if (!nameEntry) { continue; } diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index bb04e2d2d..490262ebd 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -3517,10 +3517,10 @@ class InkAnnotationElement extends AnnotationElement { g.setAttribute("fill", "transparent"); g.setAttribute("transform", transform); - for (let i = 0, ii = inkLists.length; i < ii; i++) { + for (const inkList of inkLists) { const polyline = this.svgFactory.createElement(this.svgElementName); this.#polylines.push(polyline); - polyline.setAttribute("points", inkLists[i].join(",")); + polyline.setAttribute("points", inkList.join(",")); g.append(polyline); } diff --git a/web/debugger.mjs b/web/debugger.mjs index 5f6fd2b2b..273b35b43 100644 --- a/web/debugger.mjs +++ b/web/debugger.mjs @@ -517,8 +517,7 @@ class Stepper { return 0; }); - for (let i = 0; i < operatorsGroupsByZindex.length; i++) { - const group = operatorsGroupsByZindex[i]; + for (const group of operatorsGroupsByZindex) { if (group.minX !== null) { const el = this.#c("div"); el.style.left = `${group.minX * 100}%`;