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); + } } }