[Project_owners] Dynamic popup menus

Adam Judson adamsplugins at gmail.com
Tue Jul 19 19:05:44 EDT 2005


I'm dynamically creating a cascading context menu, using something
like this:

// popup is an existing <popup>
addPopupEntries : function(popup, someArray) {
   var menu = document.createElement("menu");
   menu.setAttribute("label", "aaa");
   var tmpPopup = document.createElement("menupopup");
   for (subId in someArray) {
      var tmpItem = document.createElement("menuitem");
      tmpItem.setAttribute("label", subId);
      tmpPopup.appendChild(tmpItem);
   }
   menu.appendChild(tmpPopup);
   popup.appendChild(menu);
},

The second level popup opens, but doesn't close when focus on a
different menuitem.

After I make a selection (from either the first or second level) none
of my dialog buttons
work, and firefox soon crashes.

I suspect something is missing in the connection between the menu and
the menupopup,
as even with no items added, I get the same behaviour.

Any thoughts, or examples of where this is already being done?

Thanks.
Adam


More information about the Project_owners mailing list