mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-05 05:47:23 +02:00
Merge pull request #21700 from Snuffleupagus/Menu-constructor-shorten
Shorten the `Menu` constructor a tiny bit
This commit is contained in:
commit
b75d2b62a3
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