rem: var saved_cpts = get_selection(component, false, true); updateSelect(cpts, sel, component, merging); 
add: var saved_cpts = get_selection(component, false, true, null); updateSelect(cpts, sel, component, merging, anyval); 
context: function selectProduct(product, component, version, milestone) {    if (!product) {        /* this is to avoid handling events that occur before the form         * itself is ready, which could happen in buggy browsers. */        return;    }    /* if this is the first load and nothing is selected, no need to     * merge and sort all components; perl gives it to us sorted. */    if ((first_load) && (product.selectedIndex == -1)) {        first_load = false;        return;    }    /* turn first_load off. this is tricky, since it seems to be     * redundant with the above clause. It's not: if when we first load     * the page there is _one_ element selected, it won't fall into that     * clause, and first_load will remain 1. Then, if we unselect that     * item, selectProduct will be called but the clause will be valid     * (since selectedIndex == -1), and we will return - incorrectly -     * without merge/sorting. */    first_load = false;    /* - sel keeps the array of products we are selected.     * - merging says if it is a full list or just a list of products that     *   were added to the current selection. */    var merging = false;    var sel = Array();    /* if nothing selected, pick all */    var findall = product.selectedIndex == -1;    if (useclassification) {        /* update index based on the complete product array */        sel = get_selection(product, findall, true);        for (var i=0; i<sel.length; i++) {           sel[i] = prods[sel[i]];        }    } else {        sel = get_selection(product, findall, false);    }    if (!findall) {        /* save sel for the next invocation of selectProduct() */        var tmp = sel;        /* this is an optimization: if we have just added products to an         *  existing selection, no need to clear the form controls and add         *  everybody again; just merge the new ones with the existing         *  options. */        if ((last_sel.length > 0) && (last_sel.length < sel.length)) {            sel = fake_diff_array(sel, last_sel);            merging = true;        }        last_sel = tmp;    }    /* do the actual fill/update */    if (component) {        var saved_cpts = get_selection(component, false, true);        updateSelect(cpts, sel, component, merging);        restoreSelection(component, saved_cpts);    }    if (version) {        var saved_vers = get_selection(version, false, true);        updateSelect(vers, sel, version, merging);        restoreSelection(version, saved_vers);    }    if (milestone) {        var saved_tms = get_selection(milestone, false, true);        updateSelect(tms, sel, milestone, merging);        restoreSelection(milestone, saved_tms);    }}
meta: 3132	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/3132/0cd4b869322d7f338412d604f2756d64057c9db0/productform.js/buggy/js/productform.js