* Returns the menu's options if present. Can be filtered to a subsection of the menu if provided * via `element`.
(opts: {element?: HTMLElement} = {})
| 455 | * via `element`. |
| 456 | */ |
| 457 | getOptions(opts: {element?: HTMLElement} = {}): HTMLElement[] { |
| 458 | let {element = this.getMenu()} = opts; |
| 459 | if (!element) { |
| 460 | return []; |
| 461 | } |
| 462 | |
| 463 | return Array.from( |
| 464 | element.querySelectorAll('[role=menuitem], [role=menuitemradio], [role=menuitemcheckbox]') |
| 465 | ) as HTMLElement[]; |
| 466 | } |
| 467 | |
| 468 | /** |
| 469 | * Returns the menu's submenu triggers if any. |