From ab8e67ecff97ed70d2d2041f2f8b0f41180df0d1 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 22 Feb 2026 17:54:17 +0100 Subject: [PATCH] Use `Map.prototype.getOrInsert()` in the `src/display/annotation_layer.js` file --- src/display/annotation_layer.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index e486221c1..dc8be6e8d 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -3877,12 +3877,7 @@ class AnnotationLayer { this.#elements.push(element); if (data.popupRef) { - const elements = popupToElements.get(data.popupRef); - if (!elements) { - popupToElements.set(data.popupRef, [element]); - } else { - elements.push(element); - } + popupToElements.getOrInsert(data.popupRef, []).push(element); } }