From 3ab87b9774678ac054ba86a002643a49aea10d3b Mon Sep 17 00:00:00 2001 From: bat Date: Wed, 5 Apr 2023 22:25:31 +0000 Subject: [PATCH] Test and fix top property --- dialog.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dialog.js b/dialog.js index 7ce2423..f65b98f 100644 --- a/dialog.js +++ b/dialog.js @@ -27,7 +27,7 @@ export class Dialog extends HTMLElement { const style = document.createElement('style') style.textContent = ` dialog { - margin-top: var(--margin-top, --120px); + margin-top: var(--dialog-margin-top, 120px); min-width: 200px; border: 1px solid rgba(0, 0, 0, 0.3); border-radius: 6px; @@ -84,7 +84,9 @@ export class Dialog extends HTMLElement { } set top(v) { - style.setProperty('--margin-top', `${v}px`) + this.shadowRoot.host.style.setProperty( + '--dialog-margin-top', `${v}px` + ) } get top() {