aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-10-02 08:32:13 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-10-02 08:32:13 +0800
commite71d29c4c6ea7bfac3db2fc8ccf2c70bf71d9a1f (patch)
treea35deb30511b8ed7fa60f657c0265d8688bfb88b
parentdce27734f0605700343aa3dd40449cf1c7c4f320 (diff)
feat: customize inline style for Item instance
-rw-r--r--src/MenuItem.mjs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/MenuItem.mjs b/src/MenuItem.mjs
index 026e5bf..4d321ae 100644
--- a/src/MenuItem.mjs
+++ b/src/MenuItem.mjs
@@ -1,9 +1,10 @@
1class Item extends HTMLDivElement { 1class Item extends HTMLDivElement {
2 constructor({ text, innerHTML, onclick }) { 2 constructor({ text, innerHTML, onclick, style }) {
3 super(); 3 super();
4 this.innerHTML = innerHTML ?? text; 4 this.innerHTML = innerHTML ?? text;
5 this.onclick = onclick; 5 this.onclick = onclick;
6 this.classList.add('menu-item'); 6 this.classList.add('menu-item');
7 this.style.cssText = style;
7 8
8 this.onmouseover = () => { 9 this.onmouseover = () => {
9 this.parentElement 10 this.parentElement