You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/_guide/actions.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -138,6 +138,10 @@ class HoverCard extends HTMLElement {
138
138
}
139
139
```
140
140
141
+
### Targets and "ShadowRoots"
142
+
143
+
Custom elements can create encapsulated DOM trees known as "Shadow" DOM. Catalyst actions support Shadow DOM by traversing the `shadowRoot`, if present, and also automatically watching shadowRoots for changes; auto-binding new elements as they are added.
144
+
141
145
### What about without Decorators?
142
146
143
147
If you're using decorators, then the `@controller` decorator automatically handles binding of actions to a Controller.
Custom elements can create encapsulated DOM trees known as "Shadow" DOM. Catalyst targets support Shadow DOM by traversing the `shadowRoot` first, if present.
127
+
128
+
Important to note here is that nodes from the `shadowRoot` get returned _first_. So `@targets` will return an array of nodes, where shadowRoot nodes are at the start of the Array, and `@target` will return a ShadowRoot target if it exists, otherwise it will fall back to traversing the elements direct children.
129
+
124
130
### What about without Decorators?
125
131
126
132
If you're using decorators, then the `@target` and `@targets` decorators will turn the decorated properties into getters.
0 commit comments