rem: for (var i = 0; i < NamedAnchorCount; i++) createMenuItem(menupopup, "#" + NamedAnchorNodeList.item(i).name); } for (var j = 1; j <= 6; j++) { var headingList = editor.document.getElementsByTagName("h" + j); for (var k = 0; k < headingList.length; k++) 
add:     if (element instanceof HTMLHeadingElement && element.textContent && !(element.firstChild instanceof HTMLAnchorElement && element.firstChild.name)) headingList.push(element);   if (element instanceof HTMLAnchorElement && element.name) 
context: function FillLinkMenulist(linkMenulist, headingsArray){  var menupopup = linkMenulist.firstChild;  var editor = GetCurrentEditor();  try {    var NamedAnchorNodeList = editor.document.anchors;    var NamedAnchorCount = NamedAnchorNodeList.length;    if (NamedAnchorCount > 0)    {      for (var i = 0; i < NamedAnchorCount; i++)        createMenuItem(menupopup, "#" + NamedAnchorNodeList.item(i).name);    }     for (var j = 1; j <= 6; j++)    {      var headingList = editor.document.getElementsByTagName("h" + j);      for (var k = 0; k < headingList.length; k++)      {        var heading = headingList.item(k);        // Skip headings that already have a named anchor as their first child        //  (this may miss nearby anchors, but at least we don't insert another        //   under the same heading)        var child = heading.firstChild;        if (child && child.nodeName == "A" && child.name && (child.name.length>0))          continue;        var range = editor.document.createRange();        range.setStart(heading,0);        var lastChildIndex = heading.childNodes.length;        range.setEnd(heading,lastChildIndex);        var text = range.toString();        if (text)        {          // Use just first 40 characters, don't add "...",          //  and replace whitespace with "_" and strip non-word characters          text = "#" + ConvertToCDATAString(TruncateStringAtWordEnd(text, 40, false));          // Append "_" to any name already in the list          while (linkMenulist.getElementsByAttribute("label", text).length)            text += "_";          createMenuItem(menupopup, text);          // Save nodes in an array so we can create anchor node under it later          headingsArray[text] = heading;        }      }    }    if (!menupopup.hasChildNodes())     {      var item = createMenuItem(menupopup, GetString("NoNamedAnchorsOrHeadings"));      item.setAttribute("disabled", "true");    }  } catch (e) {}}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/6f956d866c987e0c81ab244cd15c6994296e029d/EdDialogCommon.js/buggy/editor/ui/dialogs/content/EdDialogCommon.js