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) {
|
constructor(menuContainer, triggeringButton, menuItems) {
|
||||||
this.#menu = menuContainer;
|
this.#menu = menuContainer;
|
||||||
this.#triggeringButton = triggeringButton;
|
this.#triggeringButton = triggeringButton;
|
||||||
if (Array.isArray(menuItems)) {
|
this.#menuItems = Array.isArray(menuItems)
|
||||||
this.#menuItems = menuItems;
|
? menuItems
|
||||||
} else {
|
: [...this.#menu.querySelectorAll("button")];
|
||||||
this.#menuItems = [];
|
|
||||||
for (const button of this.#menu.querySelectorAll("button")) {
|
|
||||||
this.#menuItems.push(button);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.#setUpMenu();
|
this.#setUpMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user