mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-22 16:05:56 +02:00
Use Map.prototype.getOrInsertComputed() in the web/struct_tree_layer_builder.js file
This commit is contained in:
parent
0d4e587a5f
commit
185fee680a
@ -15,7 +15,7 @@
|
||||
|
||||
/** @typedef {import("../src/display/api").PDFPageProxy} PDFPageProxy */
|
||||
|
||||
import { FeatureTest, shadow } from "pdfjs-lib";
|
||||
import { FeatureTest, makeMap, shadow } from "pdfjs-lib";
|
||||
import { removeNullCharacters } from "./ui_utils.js";
|
||||
|
||||
const PDF_ROLE_TO_HTML_ROLE = {
|
||||
@ -251,12 +251,9 @@ class StructTreeLayerBuilder {
|
||||
const label = removeNullCharacters(alt);
|
||||
for (const child of structElement.children) {
|
||||
if (child.type === "annotation") {
|
||||
let attrs = this.#elementAttributes.get(child.id);
|
||||
if (!attrs) {
|
||||
attrs = new Map();
|
||||
this.#elementAttributes.set(child.id, attrs);
|
||||
}
|
||||
attrs.set("aria-label", label);
|
||||
this.#elementAttributes
|
||||
.getOrInsertComputed(child.id, makeMap)
|
||||
.set("aria-label", label);
|
||||
added = true;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user