bug: error when trying to getBoundingClientRect of non-existent image
Let me first thank everybody who works on this project, it is really awesome and has great potential!
I just tried to use this library and found a bug. I have a html page with links to images, but they do not exist on the specified paths. Smth like:
<img src="../non-existent.svg" />
When I add polyfill script with <script>
tag in the bottom of <body>
:
<!DOCTYPE HTML>
<html>
<head>
<!-- some stuff in head -->
</head>
<body>
<!-- content -->
<img src="../non-existent.svg" />
<!-- other content -->
<script src="https://unpkg.com/pagedjs/dist/paged.polyfill.js"></script>
</body>
</html>
or in node.js with following:
import { Previewer } from 'pagedjs';
let paged = new Previewer();
paged.preview();
I get following error in browser console:
paged.js:1794 Uncaught (in promise) TypeError: Cannot read property 'getBoundingClientRect' of undefined
at Page.addResizeObserver (paged.js:1794)
at Page.addListeners (paged.js:1756)
at Page.layout (paged.js:1710)
at async Chunker.layout (paged.js:2501)
at async Chunker.renderAsync (paged.js:2424)
And only content
is rendered, but other content
is not.
I am new to JS, so, please, correct me if I'm wrong.