<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [getTargetElement](./x-components.gettargetelement.md)

## getTargetElement() function

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;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  event | Event | Event which takes place in the DOM. |

**Returns:**

Element

Target Element of the event.

## Remarks

In a shadow DOM context, this function only works if the Shadow DOM uses `open` encapsulation mode.

