Skip to content

Commit

Permalink
Use Element.closest() to locate closest popover
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Nov 18, 2022
1 parent e035d52 commit 1f7ee28
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ function TestWrapper() {
* @return {HTMLElement|null} Popover element, or `null` if not found.
*/
function getWrappingPopoverElement( element ) {
if ( element.classList.contains( 'components-popover' ) ) {
return element;
}
return getWrappingPopoverElement( element.parentElement );
return element.closest( '.components-popover' );
}

describe( 'General media replace flow', () => {
Expand Down

0 comments on commit 1f7ee28

Please sign in to comment.