Invalid CSS breaks pagedjs
i tried to generate a pdf from a site where i don't have the ability to change the css.
Im using puppeteer and injecting pagedjs from unpkd but there seem to be some selectors in CSS which chrome considers to be not valid (in this case: '.plyr:-moz-full-screen .plyr__control .icon--exit-fullscreen+svg'
or more specific the :-moz*
part)
Error: Evaluation failed: DOMException: Failed to execute 'querySelectorAll' on 'DocumentFragment': '.plyr:-moz-full-screen .plyr__control .icon--exit-fullscreen+svg' is not a valid selector. at Following.processSelectors (https://unpkg.com/pagedjs/dist/paged.polyfill.js:30595:27) at Following.afterParsed (https://unpkg.com/pagedjs/dist/paged.polyfill.js:30589:9) at https://unpkg.com/pagedjs/dist/paged.polyfill.js:372:26 at Array.forEach (<anonymous>) at Hook.trigger (https://unpkg.com/pagedjs/dist/paged.polyfill.js:371:15) at Chunker.flow (https://unpkg.com/pagedjs/dist/paged.polyfill.js:2746:33) at async Previewer.preview (https://unpkg.com/pagedjs/dist/paged.polyfill.js:32770:15)
for my understanding invalid css selectors should not break the whole thing but should just be skipped by pagedjs. This is alredy done here: https://gitlab.coko.foundation/pagedjs/pagedjs/-/blob/main/src/modules/filters/undisplayed.js#L70-78 but the error seems to be coming from here: https://gitlab.coko.foundation/pagedjs/pagedjs/-/blob/main/src/modules/paged-media/following.js#L41 imho that could be fixed by just providing a helper function which wraps querySelectorAll
in a try/catch block