All pastes #154209 Raw Edit

Unnamed

public javascript v1 · immutable
#154209 ·published 2006-08-30 07:26 UTC
rendered paste body
misc.rebuildSelect = function(e,f,g) {/*{{{*/        if (f) e[e.length] = f;        var frag = document.createDocumentFragment();        var fragGroup = false;        for (var i in e) {                switch (e[i][0]) {                        case '':                                var fragGroup = document.createElement('optgroup');                                fragGroup.label = e[i][1];                                frag.appendChild(fragGroup);                                break;                        default:                                var oOption = document.createElement("option");                                oOption.innerHTML = e[i][1];                                oOption.value = (g == true ? e[i][0] : e[i][1]);                                (fragGroup !== false ? fragGroup : frag).appendChild(oOption);                }        }        return frag;}/*}}}*/