MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / getNextSibling

Function getNextSibling

ui/media/js/utils.js:4–21  ·  view source on GitHub ↗
(elem, selector)

Source from the content-addressed store, hash-verified

2
3// https://gomakethings.com/finding-the-next-and-previous-sibling-elements-that-match-a-selector-with-vanilla-js/
4function getNextSibling(elem, selector) {
5 // Get the next sibling element
6 let sibling = elem.nextElementSibling
7
8 // If there's no selector, return the first sibling
9 if (!selector) {
10 return sibling
11 }
12
13 // If the sibling matches our selector, use it
14 // If not, jump to the next sibling and continue the loop
15 while (sibling) {
16 if (sibling.matches(selector)) {
17 return sibling
18 }
19 sibling = sibling.nextElementSibling
20 }
21}
22
23/* Panel Stuff */
24

Callers 1

toggleCollapsibleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected