@progress/kendo-angular-navigation
Version:
Kendo UI Navigation for Angular
23 lines (22 loc) • 946 B
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { isPresent } from './util';
const closestInScope = (target, targetAttr, predicate, scope) => {
while (target && target !== scope && !predicate(target, targetAttr)) {
target = target.parentNode;
}
if (target !== scope) {
return target;
}
};
const hasItemIndex = (item, indexAttr) => isPresent(item.getAttribute(indexAttr));
/**
* @hidden
*/
export const itemIndex = (item, indexAttr) => +item.getAttribute(indexAttr);
/**
* @hidden
*/
export const closestItem = (target, targetAttr, scope) => closestInScope(target, targetAttr, hasItemIndex, scope);