@empathyco/x-components
Version:
Empathy X Components
31 lines (17 loc) • 1 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[](./index.md) > [@empathyco/x-components](./x-components.md) > [getTargetElement](./x-components.gettargetelement.md)
Returns the target element for a given event. The target element is obtained from `composedPath` Event method because if the event is triggered inside a Shadow DOM context, `event.target` points to Shadow DOM element, not the element that triggered the event. `composedPath` method also is available in a non-shadow DOM context.
**Signature:**
```typescript
export declare function getTargetElement(event: Event): Element;
```
| Parameter | Type | Description |
| --- | --- | --- |
| event | Event | Event which takes place in the DOM. |
**Returns:**
Element
Target Element of the event.
In a shadow DOM context, this function only works if the Shadow DOM uses `open` encapsulation mode.