rem:  editorShell.InsertElement(tableElement, false); 
add: try {  editorShell.InsertElementAtSelection(tableElement, false); } catch (e) { dump("Exception occured in InsertElementAtSelection\n"); } 
context: function onOK(){  if (ValidateData())  {    editorShell.CloneAttributes(tableElement, globalElement);    // Create necessary rows and cells for the table    dump("Rows = "+rows+"  Columns = "+columns+"\n");    for (i = 0; i < rows; i++)    {      newRow = editorShell.CreateElementWithDefaults("tr");      if (newRow)      {        tableElement.appendChild(newRow);        for (j = 0; j < columns; j++)        {          newCell = editorShell.CreateElementWithDefaults("td");          if (newCell)          {            newRow.appendChild(newCell);          }        }      }    }    // Don't delete selected text when inserting    editorShell.InsertElement(tableElement, false);    return true;  }  return false;}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/711c0f72c9655c2558d43bb716847f1a294b8372/EdInsertTable.js/buggy/editor/ui/dialogs/content/EdInsertTable.js