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
@ -145,14 +145,21 @@ class BaseViewer {
|
|||||||
this.viewer = options.viewer || options.container.firstElementChild;
|
this.viewer = options.viewer || options.container.firstElementChild;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(typeof PDFJSDev === "undefined" ||
|
typeof PDFJSDev === "undefined" ||
|
||||||
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
|
PDFJSDev.test("!PRODUCTION || GENERIC")
|
||||||
!(
|
|
||||||
this.container instanceof HTMLDivElement &&
|
|
||||||
this.viewer instanceof HTMLDivElement
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
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.eventBus = options.eventBus;
|
||||||
this.linkService = options.linkService || new SimpleLinkService();
|
this.linkService = options.linkService || new SimpleLinkService();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user