blob: 366a823d691de5a852324e70efe890d17aefb283 [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001define( [
2 "../../core"
3], function( jQuery ) {
4
5"use strict";
6
7return function( elem, dir, until ) {
8 var matched = [],
9 truncate = until !== undefined;
10
11 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
12 if ( elem.nodeType === 1 ) {
13 if ( truncate && jQuery( elem ).is( until ) ) {
14 break;
15 }
16 matched.push( elem );
17 }
18 }
19 return matched;
20};
21
22} );