mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Bundle the <dialog>
polyfill-CSS in the GENERIC legacy/
-viewer (PR 14710 follow-up)
In PR 14710 we only included the JavaScript-part of the polyfill, however we probably need to include the CSS as well to reduce the risk of problems in older browsers. With the recent CSS-related improvements in the `preprocess`-function we could probably have included this conditionally in the `viewer.css` file. However, considering that the `<dialog>` polyfill-code is only invoked when actually needed it seemed most appropriate/correct to lazy-load the polyfill-CSS as well.
This commit is contained in:
parent
1953967681
commit
bb8f5ec20b
2 changed files with 19 additions and 0 deletions
|
@ -44,6 +44,15 @@ class OverlayManager {
|
|||
) {
|
||||
const dialogPolyfill = require("dialog-polyfill/dist/dialog-polyfill.js");
|
||||
dialogPolyfill.registerDialog(dialog);
|
||||
|
||||
if (!this._dialogPolyfillCSS) {
|
||||
this._dialogPolyfillCSS = true;
|
||||
|
||||
const style = document.createElement("style");
|
||||
style.textContent = PDFJSDev.eval("DIALOG_POLYFILL_CSS");
|
||||
|
||||
document.head.insertBefore(style, document.head.firstElementChild);
|
||||
}
|
||||
}
|
||||
|
||||
dialog.addEventListener("cancel", evt => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue