rem: var selectedItem = selectElement.listElement.getElementsByAttribute( "data", languageData[languageList.data].types[fontTypes[i]] )[0]; selectElement.listElement.selectedItem = selectedItem;  variableSize.selectedItem = variableSize.getElementsByAttribute( "data", languageData[languageList.data].variableSize )[0]; fixedSize.selectedItem = fixedSize.getElementsByAttribute( "data", languageData[languageList.data].fixedSize )[0]; 
add: var dataElements = selectElement.listElement.getElementsByAttribute( "data", languageData[languageList.data].types[fontTypes[i]] ); var selectedItem = dataElements.length ? dataElements[0] : null; if (!gNoFontsForThisLang) { selectElement.listElement.selectedItem = selectedItem; variableSize.removeAttribute("disabled"); fixedSize.removeAttribute("disabled"); variableSize.selectedItem = variableSize.getElementsByAttribute( "data", languageData[languageList.data].variableSize )[0]; fixedSize.selectedItem = fixedSize.getElementsByAttribute( "data", languageData[languageList.data].fixedSize )[0]; } else { variableSize.setAttribute("disabled","true"); fixedSize.setAttribute("disabled","true"); } 
context: function selectLanguage()	{    // save current state    saveState();        if( !currentLanguage )      currentLanguage = languageList.data;              for( var i = 0; i < fontTypes.length; i++ )      {        // build and populate the font list for the newly chosen font type        var selectElement = new listElement( fontTypes[i] );        selectElement.clearList();        selectElement.appendStrings( enumerator.EnumerateFonts( languageList.data, fontTypes[i], fontCount ) );                if( languageData[languageList.data] )          {            // data exists for this language, pre-select items based on this information            var selectedItem = selectElement.listElement.getElementsByAttribute( "data", languageData[languageList.data].types[fontTypes[i]] )[0];            selectElement.listElement.selectedItem = selectedItem;            variableSize.selectedItem = variableSize.getElementsByAttribute( "data", languageData[languageList.data].variableSize )[0];            fixedSize.selectedItem = fixedSize.getElementsByAttribute( "data", languageData[languageList.data].fixedSize )[0];          }        else          {            try               {                var fontPrefString = "font.name." + fontTypes[i] + "." + languageList.data;                var selectVal = parent.hPrefWindow.pref.CopyUnicharPref( fontPrefString );                var selectedItem = selectElement.listElement.getElementsByAttribute( "data", selectVal )[0];                selectElement.listElement.data = selectVal;                selectElement.listElement.selectedItem = selectedItem;                var variableSizePref = "font.size.variable." + languageList.data;                var fixedSizePref = "font.size.fixed." + languageList.data;                var sizeVarVal = parent.hPrefWindow.pref.GetIntPref( variableSizePref );                var sizeFixedVal = parent.hPrefWindow.pref.GetIntPref( fixedSizePref );                variableSize.data = sizeVarVal;                variableSize.selectedItem = variableSize.getElementsByAttribute( "data", sizeVarVal )[0];                fixedSize.data = sizeFixedVal;                fixedSize.selectedItem = fixedSize.getElementsByAttribute( "data", sizeFixedVal )[0];              }            catch(e)              {                // if we don't find an existing pref, it's no big deal.               }          }      }    currentLanguage = languageList.data;  }
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/bab282a3bf04fbd2f60a613d7810fa4e3abe4a31/pref-fonts.js/buggy/xpfe/components/prefwindow/resources/content/pref-fonts.js