Skip to content

Commit 47604d6

Browse files
authored
reword and put in aside
1 parent da40e2b commit 47604d6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/lit-dev-content/site/docs/v3/components/shadow-dom.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,12 @@ You can specify fallback content for a slot. The fallback content is shown when
176176
177177
## Accessing slotted children { #accessing-slotted-children }
178178
179+
{% aside "info" %}
180+
179181
To access children assigned to slots in your shadow root, you can use the standard `slot.assignedNodes` or `slot.assignedElements` methods with the `slotchange` event.
180182
183+
{% endaside %}
184+
181185
For example, you can create a getter to access assigned elements for a particular slot:
182186
183187
```js
@@ -187,7 +191,7 @@ get _slottedChildren() {
187191
}
188192
```
189193
190-
The nodes are assigned after the slot is rendered, so you need to check them in `updated`, or if you want to use them in rendering, you can use `slotchange`.
194+
The elements are assigned only after the slot is rendered, so if you need to access assigned elements at startup, you need to wait for `firstUpdated` or `updated`. If you want to access assigned elements when your render changes, you can use `slotchange`.
191195
192196
You can use the `slotchange` event to take action when nodes are first assigned or change.
193197
The following example extracts the text content of all of the slotted children.

0 commit comments

Comments
 (0)