Closed routeone34 closed 3 weeks ago
I'm probably missing something because if I'm reading it correctly, it looks like x.attrs
is Object.fromEntries(Array.from(el.attributes))
, which should never be null or undefined.
Can you provide more information? Like a minimal reproducible example, or at least what sort of error you're seeing.
I don't know the specification of epub exactly. A book with the attached opf cannot be opened with the original code.
console.log of the case is below.
reader.js:219 TypeError: Cannot read properties of undefined (reading 'alt-rep') at makeLanguageMap (epub.js:218:31) at getMetadata (epub.js:265:16) at EPUB.init (epub.js:1010:48) at async makeBook (view.js:103:20) at async View.open (view.js:234:37) at async Reader.open (reader.js:109:9) at async open (reader.js:209:5)
Just information.
epub.js: line218 //const altRep = x.attrs['alt-rep'] const altRep = x.attrs?.['alt-rep']