rem:   if (this.listNode.hasChildNodes()) { this.listNode.insertBefore(listItem, this.listNode.firstChild); } else { debug.print("QueryHistoryClass.add: first entry"); this.listNode.appendChild(listItem); } 
context:     this.add = function(query) {        debug.print("QueryHistoryClass.add: " + query);        if (query == null || query == "") {            return;        }        // the whitespace-normalized query acts as the hash key        var key = normalizeSpace(query);        if (key == null || key == "") {            return;        }        //debug.print("QueryHistoryClass.add: " + ": " + key);        // lazy initialization        if (null == this.listNode.parentNode) {            // We haven't attached the listNode to the document yet:            // remove any existing text and attach our listNode.            Element.update(this.node, '');            this.node.appendChild(this.listNode);        }        var listItem = this.hash[key];        if (null != listItem) {            // new query has a duplicate: replace the existing item.            Element.remove(listItem);        }        // build a new listItem        listItem = this.newListItem(key, query);        // place the new listItem at the top of the listNode children        if (this.listNode.hasChildNodes()) {            this.listNode.insertBefore(listItem, this.listNode.firstChild);        } else {            debug.print("QueryHistoryClass.add: first entry");            this.listNode.appendChild(listItem);        }        // update the hash        this.hash[key] = listItem;        this.lastModified = new Date();        // check size limit, and truncate if needed        var values = this.hash.values();        if (values.length > this.size) {            debug.print("QueryHistoryClass.add: truncating "                        + values.length + " > " + this.size);            for (i = this.size; i < values.length; i++) {                debug.print("QueryHistoryClass.add: truncating " + i);                this.remove(values[i]);            }        }    }
meta: 952	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/952/d247a1b6dacb7417d1b16dd5d23f8786e47c143b/query.js/buggy/query.js