From 99a999531ea85a850772dcbd8a324a46fef46201 Mon Sep 17 00:00:00 2001 From: Tobias Buschor Date: Fri, 18 Feb 2022 09:57:04 +0100 Subject: [PATCH] Update dialog.js --- dialog.js | 75 +++++++++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/dialog.js b/dialog.js index 68d9aaf..78ea52f 100644 --- a/dialog.js +++ b/dialog.js @@ -82,43 +82,42 @@ if (!window.HTMLDialogElement) { activeDialog.close(); },true) -const css = ` -dialog:not([open]) { - display: none; -} -dialog { - display: block; - position: absolute; - left: 0; - right: 0; - width: fit-content; - height: fit-content; - margin: auto; - border-width: initial; - border-style: solid; - border-color: initial; - border-image: initial; - padding: 1em; - background: white; - color: black; -} -.dialog-polyfill-as-modal { - position: fixed; - top: 0; - bottom: 0; - max-width: calc((100% - 6px) - 2em); - max-height: calc((100% - 6px) - 2em); - overflow: auto; -} -dialog + .backdrop { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - background:#0002; -} -`; -document.head.insertAdjacentHTML('afterbegin',''); + const css = + 'dialog:not([open]){'+ + 'display:none;'+ + '}'+ + 'dialog{'+ + 'display:block;'+ + 'position:absolute;'+ + 'left:0;'+ + 'right:0;'+ + 'width:fit-content;'+ + 'height:fit-content;'+ + 'margin:auto;'+ + 'border-width:initial;'+ + 'border-style:solid;'+ + 'border-color:initial;'+ + 'border-image:initial;'+ + 'padding:1em;'+ + 'background:white;'+ + 'color:black;'+ + '}'+ + '.dialog-polyfill-as-modal{'+ + 'position:fixed;'+ + 'top:0;'+ + 'bottom:0;'+ + 'max-width:calc((100% - 6px) - 2em);'+ + 'max-height:calc((100% - 6px) - 2em);'+ + 'overflow:auto;'+ + '}'+ + 'dialog + .backdrop{'+ + 'position:fixed;'+ + 'top:0;'+ + 'right:0;'+ + 'bottom:0;'+ + 'left:0;'+ + 'background:#0002;'+ + '}'; + document.head.insertAdjacentHTML('afterbegin',''); } \ No newline at end of file