From a3271fb9166f84a7ef0bf4c0684212e6830c795a Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Thu, 3 Jun 2021 21:03:45 +0530 Subject: [PATCH] Fix Menu: Use t instead of tag to get events - Also move constructor up Signed-off-by: RMidhunSuresh --- src/platform/web/ui/general/Menu.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/platform/web/ui/general/Menu.js b/src/platform/web/ui/general/Menu.js index d7e1ce09..8a57a7fc 100644 --- a/src/platform/web/ui/general/Menu.js +++ b/src/platform/web/ui/general/Menu.js @@ -15,9 +15,14 @@ limitations under the License. */ import {TemplateView} from "./TemplateView.js"; -import { tag } from "./html.js"; export class Menu extends TemplateView { + + constructor(options) { + super(); + this._options = options; + } + static optionWithButton(label, callback) { const option = new MenuOption(label); option.setCallback(callback); @@ -30,17 +35,12 @@ export class Menu extends TemplateView { return option; } - constructor(options) { - super(); - this._options = options; - } - - _convertToDOM(option) { + _convertToDOM(t, option) { if (option.callback) { - return tag.button({ className: "menu-item", onClick: option.callback }, option.label); + return t.button({ className: "menu-item", onClick: option.callback }, option.label); } else if (option.link) { - return tag.a({ className: "menu-item", href: option.link }, option.label); + return t.a({ className: "menu-item", href: option.link }, option.label); } } @@ -55,7 +55,7 @@ export class Menu extends TemplateView { } return t.li({ className, - }, this._convertToDOM(o)); + }, this._convertToDOM(t, o)); })); } }