rem: if (dataEls.length) 
add: if (dataEls.item(0)) 
context: function lazyAppendFontNames( i )  {     // schedule the build of the next font list     if (i+1 < fontTypes.length)       {         window.setTimeout(lazyAppendFontNames, 100, i+1);       }     // now build and populate the fonts for the requested font type     var defaultItem = null;     var selectElement = new listElement( fontTypes[i] );     selectElement.clearList();     try       {         defaultItem = selectElement.appendFontNames( languageList.value, fontTypes[i] );       }     catch(e) {         dump("pref-fonts.js: " + e + "\nFailed to build the font list for " + fontTypes[i] + "\n");         return;       }     // now set the selected font item for the drop down list     if (!defaultItem)       return; // nothing to select, so no need to bother     // the item returned by default is our last resort fall-back     var selectedItem = defaultItem;     if( languageList.value in languageData )       {         // data exists for this language, pre-select items based on this information         var dataVal = languageData[languageList.value].types[fontTypes[i]];         if (!dataVal.length) // special blank means the default           {             selectedItem = defaultItem;           }         else           {             var dataEls = selectElement.listElement.getElementsByAttribute( "value", dataVal );             selectedItem = dataEls.length ? dataEls[0] : defaultItem;           }       }     else       {         try           {             var fontPrefString = "font.name." + fontTypes[i] + "." + languageList.value;             var selectVal = parent.hPrefWindow.pref.getComplexValue( fontPrefString, Components.interfaces.nsISupportsString ).data;             var dataEls = selectElement.listElement.getElementsByAttribute( "value", selectVal );             // we need to honor name-list in case name is unavailable              if (!dataEls.length) {                 var fontListPrefString = "font.name-list." + fontTypes[i] + "." + languageList.value;                 var nameList = parent.hPrefWindow.pref.getComplexValue( fontListPrefString, Components.interfaces.nsISupportsString ).data;                 var fontNames = nameList.split(",");                 var stripWhitespace = /^\s*(.*)\s*$/;                 for (j = 0; j < fontNames.length; j++) {                   selectVal = fontNames[j].replace(stripWhitespace, "$1");                   dataEls = selectElement.listElement.getElementsByAttribute("value", selectVal);                   if (dataEls.length)                       break;  // exit loop if we find one                 }             }             selectedItem = dataEls.length ? dataEls[0] : defaultItem;           }         catch(e) {             selectedItem = defaultItem;           }       }     selectElement.listElement.selectedItem = selectedItem;     selectElement.listElement.removeAttribute( "disabled" );  }
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/8395/416b1bf35e26e549b9ba3728c9c72e1bfec93b42/pref-fonts.js/buggy/suite/common/pref/pref-fonts.js