danomatic / react-pdf-html

Render HTML in react-pdf
MIT License
167 stars 40 forks source link

fix: potential crash on text nodes in ordered list #102

Closed robbeman closed 1 month ago

robbeman commented 1 month ago

Fixes a little bug I introduced with #87

We were using minified html, but when using formatted html (with indents and newlines) there are text nodes between list items.

While I was at it also ignoring other tag types.

One concern I have is this type casting:

sibling = currentElement.previousElementSibling as HtmlElement | null;

It was needed to get the tag and indexOfType properties. Those are actually available here, but not typed.