Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions source/api/cypress-api/dom.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@ Cypress.dom.isHidden(element)

# Examples

## Is attached

**Returns a boolean indicating whether an element is attached to the DOM.**

```javascript
cy.get('button').then(($el) => {
Cypress.dom.isAttached($el) // true
})
```

## Is descendent

**Returns a boolean indicating whether an element is a descendent of another element.**

```javascript
cy.get('div').then(($el) => {
Cypress.dom.isDescendent($el.parent(), $el) // true
})
```

## Is detached

**Returns a boolean indicating whether an element is detached from the DOM.**
Expand Down Expand Up @@ -48,6 +68,16 @@ cy.get('body').then(($el) => {
})
```

## Is element

**Returns a boolean indicating whether an object is a DOM element.**

```javascript
cy.get('p').then(($el) => {
Cypress.dom.isElement($el) // true
})
```

## Is focusable

**Returns a boolean indicating whether an element can receive focus.**
Expand All @@ -60,6 +90,16 @@ cy.get('input').then(($el) => {
})
```

## Is focused

**Returns a boolean indicating whether an element currently has focus.**

```javascript
cy.get('button').then(($el) => {
Cypress.dom.isFocused($el)
})
```

## Is hidden

**Returns a boolean indicating whether an element is hidden.**
Expand All @@ -72,6 +112,16 @@ cy.get('p').then(($el) => {
})
```

## Is jQuery

**Returns a boolean indicating whether an object is a jQuery object.**

```javascript
cy.get('input').then(($el) => {
Cypress.dom.isJquery($el)
})
```

## Is scrollable

**Returns a boolean indicating whether an element is scrollable.**
Expand All @@ -94,3 +144,12 @@ cy.get('img').then(($el) => {
})
```

## Is window

**Returns a boolean indicating whether an object is a window object.**

```javascript
cy.get(window).then(($el) => {
Cypress.dom.isWindow($el) // true
})
```