mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
[GENERIC viewer] Skip the iframe
-case when checking if the container
div, on BaseViewer
-instances, is absolutely positioned (PR 12354 follow-up)
Given that `getComputedStyle` only works on visible elements, the result of PR 12354 is that if the viewer is placed in a *hidden* `iframe` the viewer will now be broken. This obviously wasn't the intention of that PR, hence I believe that we should limit the `position: absolute;` check slightly to avoid this.
This commit is contained in:
parent
884c65c602
commit
9fa20ad8c5
1 changed files with 4 additions and 1 deletions
|
@ -172,7 +172,10 @@ class BaseViewer {
|
|||
throw new Error("Invalid `container` and/or `viewer` option.");
|
||||
}
|
||||
|
||||
if (getComputedStyle(this.container).position !== "absolute") {
|
||||
if (
|
||||
this.container.offsetParent &&
|
||||
getComputedStyle(this.container).position !== "absolute"
|
||||
) {
|
||||
throw new Error("The `container` must be absolutely positioned.");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue