File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 1515
1616/** @typedef {import("../src/display/api").PDFPageProxy } PDFPageProxy */
1717
18- import { FeatureTest , shadow } from "pdfjs-lib" ;
18+ import { FeatureTest , makeMap , shadow } from "pdfjs-lib" ;
1919import { removeNullCharacters } from "./ui_utils.js" ;
2020
2121const PDF_ROLE_TO_HTML_ROLE = {
@@ -251,12 +251,9 @@ class StructTreeLayerBuilder {
251251 const label = removeNullCharacters ( alt ) ;
252252 for ( const child of structElement . children ) {
253253 if ( child . type === "annotation" ) {
254- let attrs = this . #elementAttributes. get ( child . id ) ;
255- if ( ! attrs ) {
256- attrs = new Map ( ) ;
257- this . #elementAttributes. set ( child . id , attrs ) ;
258- }
259- attrs . set ( "aria-label" , label ) ;
254+ this . #elementAttributes
255+ . getOrInsertComputed ( child . id , makeMap )
256+ . set ( "aria-label" , label ) ;
260257 added = true ;
261258 }
262259 }
You can’t perform that action at this time.
0 commit comments