Browse
For agents
About
Block Animations, Motion & Scroll Effects – Ghost Kit
/
3.3.3
Block Animations, Motion & Scroll Effects – Ghost Kit
v3.3.3
Switch version
3.7.2
3.7.1
3.7.0
3.6.1
trunk
1.6.3
2.25.0
3.3.0
3.3.1
3.3.2
3.3.3
3.4.0
3.4.1
3.4.2
3.4.3
3.4.4
3.4.5
3.4.6
3.5.0
3.5.1
3.6.0
Overview
Code
ghostkit
/
gutenberg
/
utils
/
get-parents
/
index.js
index.js
in Block Animations, Motion & Scroll Effects – Ghost Kit 3.3.3, at gutenberg/utils/get-parents/index.js
14 lines
326 B
Find file
t
No matching file
Up and down to move
Enter to open
Esc to close
Raw
Download
Zip
View raw
1
/**
2
* Get parent elements.
3
*
4
*
@
param
{
Element
}
$element
- an element to search for parent elements
5
*
@
return
{
Array
}
- parent elements
6
*/
7
export
default
function
getParents
(
$element
)
{
8
const
result
=
[
]
;
9
for
(
let
p
=
$element
&&
$element
.
parentElement
;
p
;
p
=
p
.
parentElement
)
{
10
result
.
push
(
p
)
;
11
}
12
return
result
;
13
}
14