kopia lustrzana https://github.com/shoelace-style/shoelace
Return '' for slots that are null or not loaded
rodzic
2aa0f83e6a
commit
6529200dda
|
|
@ -24,7 +24,7 @@ export function getInnerHTML(slot: HTMLSlotElement): string {
|
||||||
// string. This is useful because we can't use slot.textContent as an alternative.
|
// string. This is useful because we can't use slot.textContent as an alternative.
|
||||||
//
|
//
|
||||||
export function getTextContent(slot: HTMLSlotElement): string {
|
export function getTextContent(slot: HTMLSlotElement): string {
|
||||||
const nodes = slot.assignedNodes({ flatten: true });
|
const nodes = slot ? slot.assignedNodes({ flatten: true }) : [];
|
||||||
let text = '';
|
let text = '';
|
||||||
|
|
||||||
[...nodes].map(node => {
|
[...nodes].map(node => {
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue