rem: newMenuItem = document.createElement('menuitem'); newMenuItem.setAttribute('label', tag); newMenuItem.setAttribute('value',  key); newMenuItem.setAttribute('type', 'checkbox'); 
add: var newMenuItem = document.createElement("menuitem"); SetMessageTagLabel(newMenuItem, ++index, tag); newMenuItem.setAttribute("value", key); newMenuItem.setAttribute("type", "checkbox"); 
context: function InitMessageTags(menuPopup){  var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"].getService(Components.interfaces.nsIMsgTagService);  var allTags = tagService.tagEnumerator;  var allKeys = tagService.keyEnumerator;    // remove existing entries up until the menuseparator which precedes the Add New Tag option  while (menuPopup.firstChild && menuPopup.firstChild.localName != 'menuseparator')    menuPopup.removeChild(menuPopup.firstChild);      var menuSeparatorNode = menuPopup.firstChild;  // now rebuild the list  var msgHdr = gDBView.hdrForFirstSelectedMessage;  var curKeys = msgHdr.getStringProperty("keywords");  var newMenuItem;   var curMsgHdrKeyArray = curKeys.split(" ");  if (msgHdr.label != 0)    curMsgHdrKeyArray.push("$label" + msgHdr.label);      while (allTags.hasMore())  {    var tag = allTags.getNext();    var key = allKeys.getNext();    // TODO we want to either remove or "check" the tags that already exist    newMenuItem = document.createElement('menuitem');    newMenuItem.setAttribute('label', tag);    newMenuItem.setAttribute('value',  key);    newMenuItem.setAttribute('type', 'checkbox');    newMenuItem.style.color = tagService.getColorForKey(key);        var removeKey = (" " + curKeys + " ").indexOf(" " + key + " ") > -1;    newMenuItem.setAttribute('checked', removeKey);    newMenuItem.setAttribute('oncommand', 'ToggleMessageTagCmd(event.target)');    menuPopup.insertBefore(newMenuItem, menuSeparatorNode);  }}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/6ecc1879bdc503622258ea862c52ee0e2545a1d3/mailWindowOverlay.js/buggy/mail/base/content/mailWindowOverlay.js