Closed lizadaly closed 1 year ago
Looking into that failing test; it's passing locally.
This is excellent, @lizadaly .
Add annotations using
insertAdjacentHTML
rather thaninsertAdjacentElement
(Mozilla says it's faster and my benchmarks agreed)
I would have assumed the opposite!
This makes a number of simplifying and performance-enhancing changes to reading mode. It also firmly breaks reading mode away from PagedJS/PDF rendering in favor of choices that benefit screen reading only.
This does not truly break PDF output—you can still get a file from the export button—but that file looks very primitive now. I'm going to add back in PDF-centric styles in further work.
This PR:
template
element. The former step was an optimization designed to inject annotations synchronously before PDF rendering; now the content goes straight to the browser and the annotations are added more opportunistically.And lots of small-ish performance optimizations:
insertAdjacentHTML
rather thaninsertAdjacentElement
(Mozilla says it's faster and my benchmarks agreed)requestIdleCallback
for a few mutations that don't visibly affect layoutLighthouse metrics before/after
Before
After
(The absolute numbers vary a lot between casebooks so this is more about the relative difference.)