MenuManager.createMenu Member

Creates menu DOM nodes from a menu specification.

Syntax

object.createMenu(parentNode, beforeNode, menuName, domId, attribs);

Arguments

ArgumentSummary
parentNode DOM Node to insert into
beforeNode DOM Node already contained by parentNode, to insert before
menuName
domId
attribs

Returns

Remarks

See Also

Source Code

function mmgr_newmenu (parentNode, beforeNode, menuName, domId, attribs)
{
if (typeof domId == "undefined")
domId = menuName;
if (!ASSERT(menuName in this.menuSpecs, "unknown menu name " + menuName))
return null;
var menuSpec = this.menuSpecs[menuName];
if (!("accesskey" in menuSpec))
menuSpec.accesskey = getAccessKey(menuSpec.label);
var subMenu = this.appendSubMenu(parentNode, beforeNode, menuName, domId,
menuSpec.label, menuSpec.accesskey,
attribs);
// Keep track where we're adding popup nodes derived from some menuSpec
if (!("uiElements" in this.menuSpecs[menuName]))
this.menuSpecs[menuName].uiElements = [subMenu];
else if (!arrayContains(this.menuSpecs[menuName].uiElements, subMenu))
this.menuSpecs[menuName].uiElements.push(subMenu);
this.createMenuItems (subMenu, null, menuSpec.items);
return subMenu;
}