-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Support Request Description
Add function to grab text content from any slot. This will be used across all repos when needing to populate attributes/properties with slot content.
Possible Solution
getSlotText(elem, name) {
const slot = elem.shadowRoot?.querySelector(`slot[name="${name}"]`);
const nodes = slot?.assignedNodes({ flatten: true }) || [];
const text = nodes.map(n => n.textContent?.trim()).join('').trim();
return text || null;
}
Additional context
Needed to complete this story:
https://itsals.visualstudio.com/E_Retain_Content/_boards/board/t/Auro%20Design%20System/Stories?System.IterationPath=%40currentIteration%2CE_Retain_Content&System.AssignedTo=Jordan.Jones4%40alaskaair.com&workitem=1352598
Exit criteria (To be determined by the Auro team)
No response
Metadata
Metadata
Assignees
Labels
No labels