@web3r/flowerkit
Version:
Tree-shakable JavaScript and TypeScript utility library for frontend/browser apps: DOM, events, arrays, objects, strings, date, JSON, and network helpers (ESM/CJS, SSR-friendly).
19 lines (18 loc) • 728 B
text/typescript
export type TGetElSiblingsArgs = Parameters<typeof getElSiblings>;
export type TGetElSiblingsReturn = ReturnType<typeof getElSiblings>;
/**
* Gets an array of all siblings of given node
* @param el{HTMLElement} node
* @returns {Array}
* @throws {TypeError} getElSiblings: el must be an HTMLElement
* @example
* // How to get all siblings of `li` DOM-element with specific ID?
* // <ul>
* // <li id="item1">One</li>
* // <li id="item2">Two</li>
* // <li id="item3">Three</li>
* // <ul>
* const secondItem = document.getElementById("item2");
* getElSiblings(secondItem).filter(item => item !== secondItem) // [ li#item1, li#utem3 ]
*/
export declare const getElSiblings: (el: HTMLElement) => Array<ChildNode>;