add submenu in bootstrapped addon

Howto add submenu under tools menu?

I found this: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/PopupGuide/MenuModification

  var popup = document.getElementById("taskPopup");
  var newmenu = document.createElement("menu");
  popup.appendChild(newmenu);
  newmenu.label = "New";
  newmenu.appendItem("Document", "doc");
  newmenu.appendItem("Image", "image");

It adds the menu to the taskPopup, but only shows label if I remove newmenu.label and use 	newmenu.setAttribute("label", "tag backup and restore");

It creates this as a menu, but the appenItem does .. nothing??

In the tools menu, I see a new entry like
tag backup and restore>

but it does not show a popup for the submenu.

What am I doing wrong? An help is appreciated.

Klaus

0
opto
4/14/2018 10:19:05 PM
mozilla.dev.apps.thunderbird 3348 articles. 0 followers. Post Follow

1 Replies
0 Views

Similar Articles

[PageSpeed] 9

Am Sonntag, 15. April 2018 00:19:07 UTC+2 schrieb opto:
> Howto add submenu under tools menu?
> 
> I found this: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/PopupGuide/MenuModification
> 
>   var popup = document.getElementById("taskPopup");
>   var newmenu = document.createElement("menu");
>   popup.appendChild(newmenu);
>   newmenu.label = "New";
>   newmenu.appendItem("Document", "doc");
>   newmenu.appendItem("Image", "image");
> 
> It adds the menu to the taskPopup, but only shows label if I remove newmenu.label and use 	newmenu.setAttribute("label", "tag backup and restore");
> 
> It creates this as a menu, but the appenItem does .. nothing??
> 
> In the tools menu, I see a new entry like
> tag backup and restore>
> 
> but it does not show a popup for the submenu.
> 
> What am I doing wrong? An help is appreciated.
> 
> Klaus

appendItem not working in TB 52.7.0. Workaround: add menupopup to menu. Then add menuitem to menupopup (all with appendChild to their parentelement).
0
opto
4/15/2018 7:30:18 AM
Reply: