From f5ec3fb816f852669c7caa0348b7a5efafad9e82 Mon Sep 17 00:00:00 2001 From: oki07 Date: Tue, 26 Nov 2024 22:24:49 +0900 Subject: [PATCH] =?UTF-8?q?=E5=9E=8B=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF?= =?UTF-8?q?=E3=81=8C=E5=A4=B1=E6=95=97=E3=81=99=E3=82=8B=E3=81=AE=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../definitionList/sp-definition-list-dd.ts | 16 +++++++++------- .../definitionList/sp-definition-list-dt.ts | 16 +++++++++------- .../definitionList/sp-definition-list.ts | 16 +++++++++------- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/components/definitionList/sp-definition-list-dd.ts b/src/components/definitionList/sp-definition-list-dd.ts index 8afc83d..a472c42 100644 --- a/src/components/definitionList/sp-definition-list-dd.ts +++ b/src/components/definitionList/sp-definition-list-dd.ts @@ -19,13 +19,15 @@ export class SpDefinitionListDd extends HTMLElement { } connectedCallback() { - this.shadowRoot.adoptedStyleSheets = [ - ...this.shadowRoot.adoptedStyleSheets, - styles, - ]; - this.#ddElement.classList.add("base"); - this.#ddElement.innerHTML = this.innerHTML; - this.shadowRoot.appendChild(this.#ddElement); + if (this.shadowRoot) { + this.shadowRoot.adoptedStyleSheets = [ + ...this.shadowRoot.adoptedStyleSheets, + styles, + ]; + this.#ddElement.classList.add("base"); + this.#ddElement.innerHTML = this.innerHTML; + this.shadowRoot.appendChild(this.#ddElement); + } } } diff --git a/src/components/definitionList/sp-definition-list-dt.ts b/src/components/definitionList/sp-definition-list-dt.ts index 7c0a005..c7aa400 100644 --- a/src/components/definitionList/sp-definition-list-dt.ts +++ b/src/components/definitionList/sp-definition-list-dt.ts @@ -19,13 +19,15 @@ export class SpDefinitionListDt extends HTMLElement { } connectedCallback() { - this.shadowRoot.adoptedStyleSheets = [ - ...this.shadowRoot.adoptedStyleSheets, - styles, - ]; - this.#dtElement.classList.add("base"); - this.#dtElement.innerHTML = this.innerHTML; - this.shadowRoot.appendChild(this.#dtElement); + if (this.shadowRoot) { + this.shadowRoot.adoptedStyleSheets = [ + ...this.shadowRoot.adoptedStyleSheets, + styles, + ]; + this.#dtElement.classList.add("base"); + this.#dtElement.innerHTML = this.innerHTML; + this.shadowRoot.appendChild(this.#dtElement); + } } } diff --git a/src/components/definitionList/sp-definition-list.ts b/src/components/definitionList/sp-definition-list.ts index 93f5d96..47af04b 100644 --- a/src/components/definitionList/sp-definition-list.ts +++ b/src/components/definitionList/sp-definition-list.ts @@ -18,13 +18,15 @@ export class SpDefinitionList extends HTMLElement { } connectedCallback() { - this.shadowRoot.adoptedStyleSheets = [ - ...this.shadowRoot.adoptedStyleSheets, - styles, - ]; - this.#dlElement.classList.add("base"); - this.#dlElement.appendChild(this.#slotElement); - this.shadowRoot.appendChild(this.#dlElement); + if (this.shadowRoot) { + this.shadowRoot.adoptedStyleSheets = [ + ...this.shadowRoot.adoptedStyleSheets, + styles, + ]; + this.#dlElement.classList.add("base"); + this.#dlElement.appendChild(this.#slotElement); + this.shadowRoot.appendChild(this.#dlElement); + } } }