Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that the
viewer
property, on BaseViewer
-instances, is a va…
…lid div-element (issue 12320) This should help prevent future issues, caused by the user omitting the `viewer` option and/or providing an incorrect `container` option, when initializing a `BaseViewer`-instance.
- Loading branch information
89f6bb0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This broke rendering to another frame.
HTMLDivElement
is unique per window so an instance of HtmlDivElement from a subframe/alternate window will fail this test since instanceof only can check the prototype chain.89f6bb0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably test the values for the expected interface instead. Something like
?.tagName === 'DIV' && ?.ownerDocument != null
?89f6bb0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have a better check that works in both scenarios, then we're certainly open for pull requests to improve this. Thanks.
89f6bb0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How aggressive do you want the check? This is probably the most aggressive: