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/targets.md
+22-11Lines changed: 22 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -136,21 +136,32 @@ Important to note here is that nodes from the `shadowRoot` get returned _first_.
136
136
137
137
### What about without Decorators?
138
138
139
-
If you're using decorators, then the `@target` and `@targets` decorators will turn the decorated properties into getters.
139
+
If you're not using decorators, then the `@target` and `@targets` decorators have an escape hatch: you can define a static class field using the `[target.static]` computed property, as an array of key names. Like so:
140
140
141
-
If you're not using decorators, then you'll need to make a `getter`, and call `findTarget(this, key)` or `findTargets(this, key)` in the getter, for example:
Copy file name to clipboardExpand all lines: docs/_guide/your-first-component.md
+9-12Lines changed: 9 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,24 +40,21 @@ The `@controller` decorator ties together the various other decorators within Ca
40
40
41
41
- Derives a tag name based on your class name, removing the trailing `Element` suffix and lowercasing all capital letters, separating them with a dash.
42
42
- Calls `window.customElements.define` with the newly derived tag name and your class.
43
-
- Calls `defineObservedAttributes` with the class to add map any `@attr` decorators. See [attrs]({{ site.baseurl }}/guide/attrs) for more on this.
44
-
- Injects the following code inside of the `connectedCallback()` function of your class:
45
-
-`bind(this)`; ensures that as your element connects it picks up any `data-action` handlers. See [actions]({{ site.baseurl }}/guide/actions) for more on this.
46
-
-`initializeAttrs(this)`; ensures that your element binds any `data-*` attributes to props. See [attrs]({{ site.baseurl }}/guide/attrs) for more on this.
43
+
- Loads the `attrable` decorator, which provides the ability to define `@attr` decorators. See [attrs]({{ site.baseurl }}/guide/attrs) for more on this.
44
+
- Loads the `actionable` decorator, which provides the ability to bind actions. See [actions]({{ site.baseurl }}/guide/actions) for more on this.
45
+
- Loads the `targetable` decorator, which provides Target querying. See [targets]({{ site.baseurl }}/guide/targets) for more on this.
47
46
48
47
You can do all of this manually; for example here's the above `HelloWorldElement`, written without the `@controller` annotation:
0 commit comments