mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Merge pull request #12354 from Snuffleupagus/BaseViewer-container-position-absolute
Ensure that the `container` div, on `BaseViewer`-instances, is absolutely positioned
This commit is contained in:
commit
82dede0458
1 changed files with 14 additions and 7 deletions
|
@ -145,14 +145,21 @@ class BaseViewer {
|
|||
this.viewer = options.viewer || options.container.firstElementChild;
|
||||
|
||||
if (
|
||||
(typeof PDFJSDev === "undefined" ||
|
||||
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
|
||||
!(
|
||||
this.container instanceof HTMLDivElement &&
|
||||
this.viewer instanceof HTMLDivElement
|
||||
)
|
||||
typeof PDFJSDev === "undefined" ||
|
||||
PDFJSDev.test("!PRODUCTION || GENERIC")
|
||||
) {
|
||||
throw new Error("Invalid `container` and/or `viewer` option.");
|
||||
if (
|
||||
!(
|
||||
this.container instanceof HTMLDivElement &&
|
||||
this.viewer instanceof HTMLDivElement
|
||||
)
|
||||
) {
|
||||
throw new Error("Invalid `container` and/or `viewer` option.");
|
||||
}
|
||||
|
||||
if (getComputedStyle(this.container).position !== "absolute") {
|
||||
throw new Error("The `container` must be absolutely positioned.");
|
||||
}
|
||||
}
|
||||
this.eventBus = options.eventBus;
|
||||
this.linkService = options.linkService || new SimpleLinkService();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue