mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-04 21:37:23 +02:00
Shorten the Menu constructor a tiny bit
The fallback path used when the `menuItems` aren't provided/correct can be simplified, since the manual loop isn't necessary.
This commit is contained in:
parent
4806d8294e
commit
1e2c571075
11
web/menu.js
11
web/menu.js
@ -39,14 +39,9 @@ class Menu {
|
||||
constructor(menuContainer, triggeringButton, menuItems) {
|
||||
this.#menu = menuContainer;
|
||||
this.#triggeringButton = triggeringButton;
|
||||
if (Array.isArray(menuItems)) {
|
||||
this.#menuItems = menuItems;
|
||||
} else {
|
||||
this.#menuItems = [];
|
||||
for (const button of this.#menu.querySelectorAll("button")) {
|
||||
this.#menuItems.push(button);
|
||||
}
|
||||
}
|
||||
this.#menuItems = Array.isArray(menuItems)
|
||||
? menuItems
|
||||
: [...this.#menu.querySelectorAll("button")];
|
||||
this.#setUpMenu();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user