aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/MenuItem.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'src/MenuItem.mjs')
-rw-r--r--src/MenuItem.mjs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/MenuItem.mjs b/src/MenuItem.mjs
index 1035cd1..1d864fd 100644
--- a/src/MenuItem.mjs
+++ b/src/MenuItem.mjs
@@ -28,10 +28,11 @@ export class Item extends window.HTMLDivElement {
28 * @param {string} [options.style] - The CSS style string 28 * @param {string} [options.style] - The CSS style string
29 * @param {string[]} [options.className] - Additional CSS classes 29 * @param {string[]} [options.className] - Additional CSS classes
30 */ 30 */
31 constructor ({ text, innerHTML, title, onclick, style, className }) { 31 constructor ({ id, text, innerHTML, title, onclick, style, className }) {
32 super() 32 super()
33 this.innerHTML = innerHTML ?? text 33 if (id) this.id = id
34 if (title) this.title = title 34 if (title) this.title = title
35 this.innerHTML = innerHTML ?? text
35 this.onclick = onclick 36 this.onclick = onclick
36 this.style.cssText = style 37 this.style.cssText = style
37 this.classList.add('menu-item') 38 this.classList.add('menu-item')
@@ -62,8 +63,9 @@ export class Folder extends window.HTMLDivElement {
62 * @param {string} [options.innerHTML] - The HTML content of the folder 63 * @param {string} [options.innerHTML] - The HTML content of the folder
63 * @param {Item[]} options.items - The submenu items 64 * @param {Item[]} options.items - The submenu items
64 */ 65 */
65 constructor ({ text, innerHTML, items, style }) { 66 constructor ({ id, text, innerHTML, items, style }) {
66 super() 67 super()
68 if (id) this.id = id
67 this.innerHTML = innerHTML ?? text 69 this.innerHTML = innerHTML ?? text
68 this.classList.add('folder', 'menu-item') 70 this.classList.add('folder', 'menu-item')
69 this.items = items 71 this.items = items