---
name: "up.Layer.prototype.contains"
area: "API"
kind: "Instance method"
parent: "up.Layer class"
url: "https://unpoly.com/api/up.Layer.prototype.contains"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [up.Layer class](https://unpoly.com/api/up.Layer.md)</nav>

# up.Layer.prototype.contains(element)

Returns whether the given `element` is contained by this layer.

This function will always return `false` for elements in [descendant](https://unpoly.com/api/up.Layer.prototype.descendants.md) overlays, even if the descendant overlay's element is nested into the DOM tree of this layer.

---

## Parameters {#parameters}

### element {#element}

(required)

The element to test.

Type: [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element)

---

## Return value {#return-value}

Whether the layer contains the element.

Type: boolean

