rem: var table = getAncestorByTagName(tr, "table"); table.deleteRow(tr.rowIndex);  
add: var tBody = tr.parentNode; tBody.deleteRow(tr.sectionRowIndex); if (!tBody.rows.length) { tBody.parentNode.removeChild(tBody); }  
context:   function removeRow(button, propertyName) {    var tr = getAncestorByTagName(button, "tr");    var mode = null;    var selects = tr.getElementsByTagName("select");    for (var i = 0; i < selects.length; i++) {      if (selects[i].name == propertyName + "_mode") {        mode = selects[i];        break;      }    }    if (mode && (getAncestorByTagName(mode, "tr") == tr)) {      // Check whether there are more 'or' rows for this filter      var next = tr.nextSibling;      if (next && (next.className == propertyName)) {        function getChildElementAt(e, idx) {          e = e.firstChild;          var cur = 0;          while (cur <= idx) {            while (e && e.nodeType != 1) e = e.nextSibling;            if (cur++ == idx) break;            e = e.nextSibling;          }          return e;        }        var thisTh = getChildElementAt(tr, 0);        var nextTh = getChildElementAt(next, 0);        next.insertBefore(thisTh, nextTh);        nextTh.colSpan = 1;        thisTd = getChildElementAt(tr, 0);        nextTd = getChildElementAt(next, 1);        next.replaceChild(thisTd, nextTd);      }    }    // Ugly hack: Safari < 1.2 removes the DOM nodes, but not the form elements,    // so they'll get submitted twice. Setting the name of the original elements    // to an empty string before removing them seems to solve the problem    var inputs = tr.getElementsByTagName("input");    for (var j = 0; j < inputs.length; j++) inputs[j].name = "";    var selects = tr.getElementsByTagName("select");    for (var j = 0; j < selects.length; j++) selects[j].name = "";    var table = getAncestorByTagName(tr, "table");    table.deleteRow(tr.rowIndex);    if (propertyName) {      var select = document.forms["query"].elements["add_filter"];      for (var i = 0; i < select.options.length; i++) {        var option = select.options[i];        if (option.value == propertyName) option.disabled = false;      }    }  }
meta: 1293	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/1293/ee8f70e15ca54666ee9ebedd99ec936908c0d050/query.js/clean/htdocs/js/query.js