for (var parent = this.parentNode; parent; parent = parent.parentNode) { if (parent instanceof Components.interfaces.nsIDOMXULContainerElement) return parent; } return null; return this.insertItemAt(-1, aLabel, aValue); const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; var menupopup = this.menupopup; if (!menupopup) { menupopup = this.ownerDocument.createElementNS(XUL_NS, "menupopup"); this.appendChild(menupopup); } var menuitem = this.ownerDocument.createElementNS(XUL_NS, "menuitem"); menuitem.setAttribute("label", aLabel); menuitem.setAttribute("value", aValue); var before = this.getItemAtIndex(aIndex); if (before) return menupopup.insertBefore(menuitem, before); return menupopup.appendChild(menuitem); var menupopup = this.menupopup; return menupopup ? menupopup.childNodes.length : 0; = menupopup.childNodes.length) return null; return menupopup.childNodes[aIndex]; ]]>