(menu)
| 72 | } |
| 73 | |
| 74 | function cleanupSeparators(menu) { |
| 75 | const kids = Array.from(menu.children); |
| 76 | let lastWasSep = true; // leading seps hidden |
| 77 | kids.forEach((el, i) => { |
| 78 | if (el.classList.contains('sep')) { |
| 79 | const hide = lastWasSep || (i === kids.length - 1); |
| 80 | el.hidden = hide || el.hidden; // keep hidden if already hidden by state |
| 81 | lastWasSep = !el.hidden; |
| 82 | } else if (!el.hidden) { |
| 83 | lastWasSep = false; |
| 84 | } |
| 85 | }); |
| 86 | } |
| 87 | |
| 88 | // Position menu within viewport |
| 89 | function placeMenu(x, y) { |
no outgoing calls
no test coverage detected