"Empty" <ol> causing an error if it contains a non-element node
Note: This issue might relates to: #272
<ol> element is "empty" (no elements inside) but contains at least one non-element node, it will cause PagedJs to crash.
Uncaught (in promise) TypeError: Cannot read property 'dataset' of null at Lists.afterPageLayout (paged.polyfill.js:30328)
For example, the following markup won't make PagedJs crash:
But this one will (as it contains a Text node (
It seems like the problem comes from
src/modules/paged-media/lists.js, ln 18-19.
Note: Whitespace inside a node is considered as text nodes, so if you leave any white space or line feeds inside an element, that element still has child nodes.
Which means that
list.firstElementChild may not exist, because it gets the first element node.
I'll make a merge request with a fix. I made a merge request (!152)