# ghostkit/3.3.3/gutenberg/utils/get-parents/index.js

Block Animations, Motion &amp; Scroll Effects – Ghost Kit, version 3.3.3. 14 lines.

- Page: https://pluginprobe.com/plugins/ghostkit/3.3.3/code/gutenberg/utils/get-parents/index.js
- Raw: https://pluginprobe.com/plugins/ghostkit/3.3.3/raw/gutenberg/utils/get-parents/index.js
- Modified: 2024-02-18T18:40:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ghostkit/3.3.3/code/gutenberg/utils/get-parents/index.js#L10-L20`.

```javascript
/**
 * Get parent elements.
 *
 * @param {Element} $element - an element to search for parent elements
 * @return {Array} - parent elements
 */
export default function getParents($element) {
	const result = [];
	for (let p = $element && $element.parentElement; p; p = p.parentElement) {
		result.push(p);
	}
	return result;
}

```
