From 71906ed316496e462df028f5027f45bdbecdf17d Mon Sep 17 00:00:00 2001 From: Danny Moerkerke Date: Wed, 14 Dec 2022 13:15:12 +0100 Subject: [PATCH] chore: - simplified selectors for content and invoker - mentioned accordion in changeset --- .changeset/strange-dots-draw.md | 2 +- packages/ui/components/accordion/src/LionAccordion.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.changeset/strange-dots-draw.md b/.changeset/strange-dots-draw.md index c59483cd4..644d5df9c 100644 --- a/.changeset/strange-dots-draw.md +++ b/.changeset/strange-dots-draw.md @@ -2,4 +2,4 @@ '@lion/ui': patch --- -narrowed the scope of the selectors that query [slot=invoker] and [slot=content] to prevent that any nested elements with [slot=invoker] and [slot=content] are moved to slot=\_accordion as well +`accordion`: narrowed the scope of the selectors that query [slot=invoker] and [slot=content] to prevent that any nested elements with [slot=invoker] and [slot=content] are moved to slot=\_accordion as well diff --git a/packages/ui/components/accordion/src/LionAccordion.js b/packages/ui/components/accordion/src/LionAccordion.js index 63271a949..c00e72ed2 100644 --- a/packages/ui/components/accordion/src/LionAccordion.js +++ b/packages/ui/components/accordion/src/LionAccordion.js @@ -210,10 +210,10 @@ export class LionAccordion extends LitElement { */ __rearrangeInvokersAndContent() { const invokers = /** @type {HTMLElement[]} */ ( - Array.from(this.querySelectorAll(':scope > [slot="invoker"]')) + Array.from(this.children).filter(child => child.slot === 'invoker') ); const contents = /** @type {HTMLElement[]} */ ( - Array.from(this.querySelectorAll(':scope > [slot="content"]')) + Array.from(this.children).filter(child => child.slot === 'content') ); const accordion = this.shadowRoot?.querySelector('slot[name=_accordion]'); if (accordion) {