From ade02c541a8f39816ded4ee50bc0c976f8e73e65 Mon Sep 17 00:00:00 2001 From: Vladislav Tasev Date: Mon, 10 Jun 2019 10:25:35 +0300 Subject: [PATCH] fix: access DOM in connectedCallback instead of constructor --- packages/base/src/UI5Element.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/base/src/UI5Element.js b/packages/base/src/UI5Element.js index 6a03db24ab46..82f98fa6fe3f 100644 --- a/packages/base/src/UI5Element.js +++ b/packages/base/src/UI5Element.js @@ -57,12 +57,6 @@ class UI5Element extends HTMLElement { } async _initializeShadowRoot() { - const isCompact = getCompactSize(); - - if (isCompact) { - this.setAttribute("data-ui5-compact-size", ""); - } - if (this.constructor.getMetadata().getNoShadowDOM()) { return Promise.resolve(); } @@ -82,6 +76,11 @@ class UI5Element extends HTMLElement { } async connectedCallback() { + const isCompact = getCompactSize(); + if (isCompact) { + this.setAttribute("data-ui5-compact-size", ""); + } + if (this.constructor.getMetadata().getNoShadowDOM()) { return; }