summaryrefslogtreecommitdiffstats
path: root/layout/reftests/table-dom
diff options
context:
space:
mode:
Diffstat (limited to 'layout/reftests/table-dom')
-rw-r--r--layout/reftests/table-dom/appendCells1-ref.html20
-rw-r--r--layout/reftests/table-dom/appendCells1.html31
-rw-r--r--layout/reftests/table-dom/appendCellsRebuild1-ref.html33
-rw-r--r--layout/reftests/table-dom/appendCellsRebuild1.html41
-rw-r--r--layout/reftests/table-dom/appendCellsZeroColspan-ref.html28
-rw-r--r--layout/reftests/table-dom/appendCellsZeroColspan.html37
-rw-r--r--layout/reftests/table-dom/appendCol1-ref.html17
-rw-r--r--layout/reftests/table-dom/appendCol1.html27
-rw-r--r--layout/reftests/table-dom/appendCol2-ref.html19
-rw-r--r--layout/reftests/table-dom/appendCol2.html29
-rw-r--r--layout/reftests/table-dom/appendColGroup1-ref.html22
-rw-r--r--layout/reftests/table-dom/appendColGroup1.html33
-rw-r--r--layout/reftests/table-dom/appendRowsExpand1-ref.html22
-rw-r--r--layout/reftests/table-dom/appendRowsExpand1.html31
-rw-r--r--layout/reftests/table-dom/appendTbodyExpand1-ref.html23
-rw-r--r--layout/reftests/table-dom/appendTbodyExpand1.html31
-rw-r--r--layout/reftests/table-dom/deleteCellsExpandZeroColspan-ref.html14
-rw-r--r--layout/reftests/table-dom/deleteCellsExpandZeroColspan.html20
-rw-r--r--layout/reftests/table-dom/deleteCellsRebuild1-ref.html19
-rw-r--r--layout/reftests/table-dom/deleteCellsRebuild1.html26
-rw-r--r--layout/reftests/table-dom/deleteCellsShrink1-ref.html16
-rw-r--r--layout/reftests/table-dom/deleteCellsShrink1.html23
-rw-r--r--layout/reftests/table-dom/deleteCellsShrink2-ref.html21
-rw-r--r--layout/reftests/table-dom/deleteCellsShrink2.html26
-rw-r--r--layout/reftests/table-dom/deleteCol1-ref.html20
-rw-r--r--layout/reftests/table-dom/deleteCol1.html30
-rw-r--r--layout/reftests/table-dom/deleteCol2-ref.html18
-rw-r--r--layout/reftests/table-dom/deleteCol2.html30
-rw-r--r--layout/reftests/table-dom/deleteCol3-ref.html18
-rw-r--r--layout/reftests/table-dom/deleteCol3.html30
-rw-r--r--layout/reftests/table-dom/deleteColGroup1-ref.html16
-rw-r--r--layout/reftests/table-dom/deleteColGroup1.html27
-rw-r--r--layout/reftests/table-dom/deleteColGroup2-ref.html16
-rw-r--r--layout/reftests/table-dom/deleteColGroup2.html27
-rw-r--r--layout/reftests/table-dom/deleteRowsRebuild1-ref.html21
-rw-r--r--layout/reftests/table-dom/deleteRowsRebuild1.html35
-rw-r--r--layout/reftests/table-dom/deleteRowsRebuild1a-ref.html15
-rw-r--r--layout/reftests/table-dom/deleteRowsRebuild1a.html26
-rw-r--r--layout/reftests/table-dom/deleteRowsShrink1-ref.html20
-rw-r--r--layout/reftests/table-dom/deleteRowsShrink1.html35
-rw-r--r--layout/reftests/table-dom/deleteTbodyExpand1-ref.html31
-rw-r--r--layout/reftests/table-dom/deleteTbodyExpand1.html55
-rw-r--r--layout/reftests/table-dom/deleteTbodyRebuild1-ref.html20
-rw-r--r--layout/reftests/table-dom/deleteTbodyRebuild1.html36
-rw-r--r--layout/reftests/table-dom/insertCaptionsAndRows1-ref.html16
-rw-r--r--layout/reftests/table-dom/insertCaptionsAndRows1.html45
-rw-r--r--layout/reftests/table-dom/insertCaptionsAndRows2-ref.html19
-rw-r--r--layout/reftests/table-dom/insertCaptionsAndRows2.html46
-rw-r--r--layout/reftests/table-dom/insertCaptionsAndRows3-ref.html18
-rw-r--r--layout/reftests/table-dom/insertCaptionsAndRows3.html48
-rw-r--r--layout/reftests/table-dom/insertCaptionsAndRows4-ref.html18
-rw-r--r--layout/reftests/table-dom/insertCaptionsAndRows4.html48
-rw-r--r--layout/reftests/table-dom/insertCellsExpand1-ref.html18
-rw-r--r--layout/reftests/table-dom/insertCellsExpand1.html29
-rw-r--r--layout/reftests/table-dom/insertCellsExpand2-ref.html21
-rw-r--r--layout/reftests/table-dom/insertCellsExpand2.html29
-rw-r--r--layout/reftests/table-dom/insertCellsExpandZeroRowspan-ref.html26
-rw-r--r--layout/reftests/table-dom/insertCellsExpandZeroRowspan.html36
-rw-r--r--layout/reftests/table-dom/insertCellsRebuild1-ref.html34
-rw-r--r--layout/reftests/table-dom/insertCellsRebuild1.html41
-rw-r--r--layout/reftests/table-dom/insertCellsRebuild2-ref.html22
-rw-r--r--layout/reftests/table-dom/insertCellsRebuild2.html31
-rw-r--r--layout/reftests/table-dom/insertCellsZeroColspan-ref.html15
-rw-r--r--layout/reftests/table-dom/insertCellsZeroColspan.html28
-rw-r--r--layout/reftests/table-dom/insertColGroups1-ref.html19
-rw-r--r--layout/reftests/table-dom/insertColGroups1.html30
-rw-r--r--layout/reftests/table-dom/insertColGroups2-ref.html20
-rw-r--r--layout/reftests/table-dom/insertColGroups2.html33
-rw-r--r--layout/reftests/table-dom/insertColgroupAndRowgroup-ref.html17
-rw-r--r--layout/reftests/table-dom/insertColgroupAndRowgroup.html43
-rw-r--r--layout/reftests/table-dom/insertCols1-ref.html13
-rw-r--r--layout/reftests/table-dom/insertCols1.html25
-rw-r--r--layout/reftests/table-dom/insertCols2-ref.html13
-rw-r--r--layout/reftests/table-dom/insertCols2.html25
-rw-r--r--layout/reftests/table-dom/insertCols3-ref.html14
-rw-r--r--layout/reftests/table-dom/insertCols3.html26
-rw-r--r--layout/reftests/table-dom/insertCols4-ref.html15
-rw-r--r--layout/reftests/table-dom/insertCols4.html26
-rw-r--r--layout/reftests/table-dom/insertCols5-ref.html15
-rw-r--r--layout/reftests/table-dom/insertCols5.html26
-rw-r--r--layout/reftests/table-dom/insertRowsExpand1-ref.html18
-rw-r--r--layout/reftests/table-dom/insertRowsExpand1.html28
-rw-r--r--layout/reftests/table-dom/insertRowsRebuild1-ref.html18
-rw-r--r--layout/reftests/table-dom/insertRowsRebuild1.html28
-rw-r--r--layout/reftests/table-dom/insertTbodyExpand1-ref.html23
-rw-r--r--layout/reftests/table-dom/insertTbodyExpand1.html32
-rw-r--r--layout/reftests/table-dom/insertTbodyRebuild1-ref.html23
-rw-r--r--layout/reftests/table-dom/insertTbodyRebuild1.html32
-rw-r--r--layout/reftests/table-dom/reftest.list44
-rw-r--r--layout/reftests/table-dom/tableDom.js129
90 files changed, 2458 insertions, 0 deletions
diff --git a/layout/reftests/table-dom/appendCells1-ref.html b/layout/reftests/table-dom/appendCells1-ref.html
new file mode 100644
index 0000000000..e59fd0c427
--- /dev/null
+++ b/layout/reftests/table-dom/appendCells1-ref.html
@@ -0,0 +1,20 @@
+<HEAD>
+ </HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td><td>X1</td>
+ </tr>
+</table>
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td><td>X2</td><td>X3</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/appendCells1.html b/layout/reftests/table-dom/appendCells1.html
new file mode 100644
index 0000000000..c848def813
--- /dev/null
+++ b/layout/reftests/table-dom/appendCells1.html
@@ -0,0 +1,31 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ appendCellAt(0, 1, 1);
+
+ appendCellAt(1, 1, 1);
+ appendCellAt(1, 1, 1);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+</table>
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/appendCellsRebuild1-ref.html b/layout/reftests/table-dom/appendCellsRebuild1-ref.html
new file mode 100644
index 0000000000..96f413657f
--- /dev/null
+++ b/layout/reftests/table-dom/appendCellsRebuild1-ref.html
@@ -0,0 +1,33 @@
+<HEAD>
+</HEAD>
+<BODY>
+
+<table bgcolor=orange border>
+ <tbody>
+ <tr>
+ <td>c11</td><td rowspan=2>X1</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+ </tbody>
+</table>
+<table bgcolor=orange border>
+ <tbody>
+ <tr>
+ <td>c11</td><td rowspan=2>X2</td><td rowspan=2>X3</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+ </tbody>
+</table>
+
+
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/appendCellsRebuild1.html b/layout/reftests/table-dom/appendCellsRebuild1.html
new file mode 100644
index 0000000000..fae04b6e3b
--- /dev/null
+++ b/layout/reftests/table-dom/appendCellsRebuild1.html
@@ -0,0 +1,41 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ appendCellAt(0, 2, 1);
+
+ appendCellAt(2, 2, 1);
+ appendCellAt(2, 2, 1);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tbody>
+ <tr>
+ <td>c11</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+ </tbody>
+</table>
+<table bgcolor=orange border>
+ <tbody>
+ <tr>
+ <td>c11</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+ </tbody>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/appendCellsZeroColspan-ref.html b/layout/reftests/table-dom/appendCellsZeroColspan-ref.html
new file mode 100644
index 0000000000..38c190e181
--- /dev/null
+++ b/layout/reftests/table-dom/appendCellsZeroColspan-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
+"http://www.w3.org/TR/REC-html40/strict.dtd">
+<HEAD>
+
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+<tr>
+ <td>c11</td><td>c12</td><td>c13</td><td>c14</td>
+</tr>
+ <tr>
+ <td>c21</td><td colspan="0">X1</td>
+ </tr>
+</table>
+<table bgcolor=orange border>
+<tr><td>c11</td><td rowspan="0">X2</td> </tr>
+<tr><td>c21</td> </tr>
+<tr><td>c22</td> </tr>
+<tr><td>c23</td> </tr>
+<tr><td>c24</td> </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/appendCellsZeroColspan.html b/layout/reftests/table-dom/appendCellsZeroColspan.html
new file mode 100644
index 0000000000..0bca392c9c
--- /dev/null
+++ b/layout/reftests/table-dom/appendCellsZeroColspan.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
+"http://www.w3.org/TR/REC-html40/strict.dtd">
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ appendCellAt(1, 1, 0);
+
+ appendCellAt(2, 0, 1);
+ }
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td><td>c13</td><td>c14</td>
+ </tr>
+<tr><td>c21</td></tr>
+</table>
+<table bgcolor=orange border>
+ <tr><td>c11</td> </tr>
+<tr><td>c21</td> </tr>
+<tr><td>c22</td> </tr>
+<tr><td>c23</td> </tr>
+<tr><td>c24</td> </tr>
+
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/appendCol1-ref.html b/layout/reftests/table-dom/appendCol1-ref.html
new file mode 100644
index 0000000000..c9728b754e
--- /dev/null
+++ b/layout/reftests/table-dom/appendCol1-ref.html
@@ -0,0 +1,17 @@
+<HEAD>
+</HEAD>
+<BODY >
+<table bgcolor=orange border>
+ <col>
+ <col width=200>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/appendCol1.html b/layout/reftests/table-dom/appendCol1.html
new file mode 100644
index 0000000000..27bdcac7c5
--- /dev/null
+++ b/layout/reftests/table-dom/appendCol1.html
@@ -0,0 +1,27 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var table = document.getElementsByTagName("TABLE")[0];
+ var col = document.createElement("COL", null);
+ col.width = 200;
+ table.appendChild(col);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <col>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/appendCol2-ref.html b/layout/reftests/table-dom/appendCol2-ref.html
new file mode 100644
index 0000000000..25a652fdfb
--- /dev/null
+++ b/layout/reftests/table-dom/appendCol2-ref.html
@@ -0,0 +1,19 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <colgroup>
+ <col>
+ <col width=200>
+ </colgroup>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/appendCol2.html b/layout/reftests/table-dom/appendCol2.html
new file mode 100644
index 0000000000..cae53697ca
--- /dev/null
+++ b/layout/reftests/table-dom/appendCol2.html
@@ -0,0 +1,29 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var cg = document.getElementsByTagName("COLGROUP")[0];
+ var col = document.createElement("COL", null);
+ col.width = 200;
+ cg.appendChild(col);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <colgroup>
+ <col>
+ </colgroup>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/appendColGroup1-ref.html b/layout/reftests/table-dom/appendColGroup1-ref.html
new file mode 100644
index 0000000000..62ca7d37c8
--- /dev/null
+++ b/layout/reftests/table-dom/appendColGroup1-ref.html
@@ -0,0 +1,22 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <colgroup>
+ <col width=100>
+ </colgroup>
+ <colgroup width=200>
+ <col>
+ <col>
+ </colgroup>
+ <tr>
+ <td>col-100</td><td>cg-200</td><td>cg-200</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/appendColGroup1.html b/layout/reftests/table-dom/appendColGroup1.html
new file mode 100644
index 0000000000..c79e5907b6
--- /dev/null
+++ b/layout/reftests/table-dom/appendColGroup1.html
@@ -0,0 +1,33 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var table = document.getElementsByTagName("TABLE")[0];
+ var cg = document.createElement("COLGROUP", null);
+ cg.width=200
+ var col = document.createElement("COL", null);
+ cg.appendChild(col);
+ col = document.createElement("COL", null);
+ cg.appendChild(col);
+ table.appendChild(cg);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <colgroup>
+ <col width=100>
+ </colgroup>
+ <tr>
+ <td>col-100</td><td>cg-200</td><td>cg-200</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/appendRowsExpand1-ref.html b/layout/reftests/table-dom/appendRowsExpand1-ref.html
new file mode 100644
index 0000000000..6ced35cadc
--- /dev/null
+++ b/layout/reftests/table-dom/appendRowsExpand1-ref.html
@@ -0,0 +1,22 @@
+<HEAD>
+</HEAD>
+<BODY>
+
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+ <tr>
+ <td>X1</td><td>X2</td>
+ </tr>
+ <tr>
+ <td>X3</td><td>X4</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/appendRowsExpand1.html b/layout/reftests/table-dom/appendRowsExpand1.html
new file mode 100644
index 0000000000..ae712596af
--- /dev/null
+++ b/layout/reftests/table-dom/appendRowsExpand1.html
@@ -0,0 +1,31 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var tbody = document.getElementsByTagName("TBODY")[0];
+ var row = document.createElement("TR", null);
+ appendCell(row, 1, 1);
+ appendCell(row, 1, 1);
+ tbody.appendChild(row);
+ row = document.createElement("TR", null);
+ appendCell(row, 1, 1);
+ appendCell(row, 1, 1);
+ tbody.appendChild(row);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/appendTbodyExpand1-ref.html b/layout/reftests/table-dom/appendTbodyExpand1-ref.html
new file mode 100644
index 0000000000..9d79810793
--- /dev/null
+++ b/layout/reftests/table-dom/appendTbodyExpand1-ref.html
@@ -0,0 +1,23 @@
+<HEAD>
+
+</HEAD>
+<BODY >
+<table bgcolor=orange border>
+ <tbody>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+ </tbody>
+ <tbody>
+ <tr>
+ <td>X1</td><td>X2</td>
+ </tr>
+ </tbody>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/appendTbodyExpand1.html b/layout/reftests/table-dom/appendTbodyExpand1.html
new file mode 100644
index 0000000000..bee0c21026
--- /dev/null
+++ b/layout/reftests/table-dom/appendTbodyExpand1.html
@@ -0,0 +1,31 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var table = document.getElementsByTagName("TABLE")[0];
+ var rg = document.createElement("TBODY", null);
+ var row = document.createElement("TR");
+ appendCell(row, 1, 1);
+ appendCell(row, 1, 1);
+ rg.appendChild(row);
+ table.appendChild(rg);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tbody>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+ </tbody>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteCellsExpandZeroColspan-ref.html b/layout/reftests/table-dom/deleteCellsExpandZeroColspan-ref.html
new file mode 100644
index 0000000000..d5a1f383c9
--- /dev/null
+++ b/layout/reftests/table-dom/deleteCellsExpandZeroColspan-ref.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<body>
+<table bgcolor="orange" border="1">
+<tr>
+ <td>c11</td><td>c12</td><td>c13</td><td>c14</td>
+</tr>
+ <tr>
+ <td colspan="0">X1</td>
+ </tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/table-dom/deleteCellsExpandZeroColspan.html b/layout/reftests/table-dom/deleteCellsExpandZeroColspan.html
new file mode 100644
index 0000000000..9df0479bf5
--- /dev/null
+++ b/layout/reftests/table-dom/deleteCellsExpandZeroColspan.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<body>
+<table bgcolor="orange" border="1">
+<tr>
+ <td>c11</td><td>c12</td><td>c13</td><td>c14</td>
+</tr>
+ <tr>
+ <td id="c21">c21</td><td colspan="0">X1</td>
+ </tr>
+</table>
+
+<script>
+document.body.offsetWidth;
+c21 = document.getElementById("c21");
+c21.remove();
+</script>
+
+</body>
+</html>
diff --git a/layout/reftests/table-dom/deleteCellsRebuild1-ref.html b/layout/reftests/table-dom/deleteCellsRebuild1-ref.html
new file mode 100644
index 0000000000..db4a43ddc6
--- /dev/null
+++ b/layout/reftests/table-dom/deleteCellsRebuild1-ref.html
@@ -0,0 +1,19 @@
+<HEAD>
+</HEAD>
+<BODY>
+
+<table bgcolor=orange border>
+ <tr>
+ <td rowspan=2>c12</td><td>c13</td>
+ </tr>
+ <tr>
+ <td>c12</td><td>c22</td><td>c23</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteCellsRebuild1.html b/layout/reftests/table-dom/deleteCellsRebuild1.html
new file mode 100644
index 0000000000..c238d4e4b0
--- /dev/null
+++ b/layout/reftests/table-dom/deleteCellsRebuild1.html
@@ -0,0 +1,26 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ deleteCellAt(0, 0);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td rowspan=2>c12</td><td>c13</td>
+ </tr>
+ <tr>
+ <td>c12</td><td>c22</td><td>c23</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteCellsShrink1-ref.html b/layout/reftests/table-dom/deleteCellsShrink1-ref.html
new file mode 100644
index 0000000000..3816a15b00
--- /dev/null
+++ b/layout/reftests/table-dom/deleteCellsShrink1-ref.html
@@ -0,0 +1,16 @@
+<HEAD>
+</HEAD>
+<BODY>
+
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c13</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteCellsShrink1.html b/layout/reftests/table-dom/deleteCellsShrink1.html
new file mode 100644
index 0000000000..901be05bb5
--- /dev/null
+++ b/layout/reftests/table-dom/deleteCellsShrink1.html
@@ -0,0 +1,23 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ deleteCellAt(0, 1);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td><td>c13</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteCellsShrink2-ref.html b/layout/reftests/table-dom/deleteCellsShrink2-ref.html
new file mode 100644
index 0000000000..6747224e2a
--- /dev/null
+++ b/layout/reftests/table-dom/deleteCellsShrink2-ref.html
@@ -0,0 +1,21 @@
+<HEAD>
+
+</HEAD>
+<BODY >
+
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c13</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>c22</td><td>c23</td>
+ </tr>
+</table>
+
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteCellsShrink2.html b/layout/reftests/table-dom/deleteCellsShrink2.html
new file mode 100644
index 0000000000..0ef77ae6c2
--- /dev/null
+++ b/layout/reftests/table-dom/deleteCellsShrink2.html
@@ -0,0 +1,26 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ deleteCellAt(0, 1);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12 c12 c12 c12 c12</td><td>c13</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>c22</td><td>c23</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteCol1-ref.html b/layout/reftests/table-dom/deleteCol1-ref.html
new file mode 100644
index 0000000000..556e329bfd
--- /dev/null
+++ b/layout/reftests/table-dom/deleteCol1-ref.html
@@ -0,0 +1,20 @@
+<HEAD>
+
+</HEAD>
+<BODY>
+
+<table bgcolor=orange border>
+ <col width=200>
+ <col width=300>
+ <tr>
+ <td>200</td><td>300</td><td>auto</td>
+ </tr>
+</table>
+
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteCol1.html b/layout/reftests/table-dom/deleteCol1.html
new file mode 100644
index 0000000000..d17ccc0ee3
--- /dev/null
+++ b/layout/reftests/table-dom/deleteCol1.html
@@ -0,0 +1,30 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var col = document.getElementsByTagName("COL")[0];
+ col.parentNode.removeChild(col);
+ // HTML5 implies a colgroup around the cols,
+ // so this test case should really be XHTML
+ // in order to test bare col
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <col width=100>
+ <col width=200>
+ <col width=300>
+ <tr>
+ <td>200</td><td>300</td><td>auto</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteCol2-ref.html b/layout/reftests/table-dom/deleteCol2-ref.html
new file mode 100644
index 0000000000..351dae6d79
--- /dev/null
+++ b/layout/reftests/table-dom/deleteCol2-ref.html
@@ -0,0 +1,18 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <col width=100>
+ <col width=300>
+ <tr>
+ <td>100</td><td>300</td><td>auto</td>
+ </tr>
+</table>
+
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteCol2.html b/layout/reftests/table-dom/deleteCol2.html
new file mode 100644
index 0000000000..16016d305b
--- /dev/null
+++ b/layout/reftests/table-dom/deleteCol2.html
@@ -0,0 +1,30 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var col = document.getElementsByTagName("COL")[1];
+ col.parentNode.removeChild(col);
+ // HTML5 implies a colgroup around the cols,
+ // so this test case should really be XHTML
+ // in order to test bare col
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <col width=100>
+ <col width=200>
+ <col width=300>
+ <tr>
+ <td>100</td><td>300</td><td>auto</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteCol3-ref.html b/layout/reftests/table-dom/deleteCol3-ref.html
new file mode 100644
index 0000000000..2ad1a02b37
--- /dev/null
+++ b/layout/reftests/table-dom/deleteCol3-ref.html
@@ -0,0 +1,18 @@
+<HEAD>
+</HEAD>
+<BODY >
+<table bgcolor=orange border>
+ <col width=100>
+ <col width=200>
+ <tr>
+ <td>100</td><td>200</td><td>auto</td>
+ </tr>
+</table>
+
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteCol3.html b/layout/reftests/table-dom/deleteCol3.html
new file mode 100644
index 0000000000..1b9880b2d5
--- /dev/null
+++ b/layout/reftests/table-dom/deleteCol3.html
@@ -0,0 +1,30 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var col = document.getElementsByTagName("COL")[2];
+ col.parentNode.removeChild(col);
+ // HTML5 implies a colgroup around the cols,
+ // so this test case should really be XHTML
+ // in order to test bare col
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <col width=100>
+ <col width=200>
+ <col width=300>
+ <tr>
+ <td>100</td><td>200</td><td>auto</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteColGroup1-ref.html b/layout/reftests/table-dom/deleteColGroup1-ref.html
new file mode 100644
index 0000000000..19a2eefa2a
--- /dev/null
+++ b/layout/reftests/table-dom/deleteColGroup1-ref.html
@@ -0,0 +1,16 @@
+<HEAD>
+</HEAD>
+<BODY >
+<table bgcolor=orange border>
+ <colgroup span=2 width=200></colgroup>
+ <tr>
+ <td>200</td><td>200</td><td>auto</td><td>auto</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteColGroup1.html b/layout/reftests/table-dom/deleteColGroup1.html
new file mode 100644
index 0000000000..d8ebb88350
--- /dev/null
+++ b/layout/reftests/table-dom/deleteColGroup1.html
@@ -0,0 +1,27 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var table = document.getElementsByTagName("TABLE")[0];
+ var colgroup = document.getElementsByTagName("COLGROUP")[0];
+ table.removeChild(colgroup);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <colgroup span=2 width=100></colgroup>
+ <colgroup span=2 width=200></colgroup>
+ <tr>
+ <td>200</td><td>200</td><td>auto</td><td>auto</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteColGroup2-ref.html b/layout/reftests/table-dom/deleteColGroup2-ref.html
new file mode 100644
index 0000000000..be6d1c1c22
--- /dev/null
+++ b/layout/reftests/table-dom/deleteColGroup2-ref.html
@@ -0,0 +1,16 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <colgroup span=2 width=100></colgroup>
+ <tr>
+ <td>100</td><td>100</td><td>auto</td><td>auto</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteColGroup2.html b/layout/reftests/table-dom/deleteColGroup2.html
new file mode 100644
index 0000000000..268b8aebe4
--- /dev/null
+++ b/layout/reftests/table-dom/deleteColGroup2.html
@@ -0,0 +1,27 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var table = document.getElementsByTagName("TABLE")[0];
+ var colgroup = document.getElementsByTagName("COLGROUP")[1];
+ table.removeChild(colgroup);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <colgroup span=2 width=100></colgroup>
+ <colgroup span=2 width=200></colgroup>
+ <tr>
+ <td>100</td><td>100</td><td>auto</td><td>auto</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteRowsRebuild1-ref.html b/layout/reftests/table-dom/deleteRowsRebuild1-ref.html
new file mode 100644
index 0000000000..b28c5337ef
--- /dev/null
+++ b/layout/reftests/table-dom/deleteRowsRebuild1-ref.html
@@ -0,0 +1,21 @@
+<HEAD>
+</HEAD>
+<BODY>
+
+<table bgcolor=orange border>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+</table>
+<table bgcolor=orange border>
+ <tr>
+ <td rowspan=2>c11</td><td>c12</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteRowsRebuild1.html b/layout/reftests/table-dom/deleteRowsRebuild1.html
new file mode 100644
index 0000000000..6964d7e86d
--- /dev/null
+++ b/layout/reftests/table-dom/deleteRowsRebuild1.html
@@ -0,0 +1,35 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ deleteRowAt(0, 0);
+ deleteRowAt(1, 1);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tr>
+ <td rowspan=2>c11</td><td>c12</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+</table>
+<table bgcolor=orange border>
+ <tr>
+ <td rowspan=2>c11</td><td>c12</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteRowsRebuild1a-ref.html b/layout/reftests/table-dom/deleteRowsRebuild1a-ref.html
new file mode 100644
index 0000000000..a701f840c3
--- /dev/null
+++ b/layout/reftests/table-dom/deleteRowsRebuild1a-ref.html
@@ -0,0 +1,15 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteRowsRebuild1a.html b/layout/reftests/table-dom/deleteRowsRebuild1a.html
new file mode 100644
index 0000000000..e4465dabd2
--- /dev/null
+++ b/layout/reftests/table-dom/deleteRowsRebuild1a.html
@@ -0,0 +1,26 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ deleteRowAt(0, 0);
+ }
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tr>
+ <td rowspan=2>c11</td><td>c12</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteRowsShrink1-ref.html b/layout/reftests/table-dom/deleteRowsShrink1-ref.html
new file mode 100644
index 0000000000..93fca9089c
--- /dev/null
+++ b/layout/reftests/table-dom/deleteRowsShrink1-ref.html
@@ -0,0 +1,20 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+</table>
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteRowsShrink1.html b/layout/reftests/table-dom/deleteRowsShrink1.html
new file mode 100644
index 0000000000..8ec4a2d770
--- /dev/null
+++ b/layout/reftests/table-dom/deleteRowsShrink1.html
@@ -0,0 +1,35 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ deleteRowAt(0, 0);
+ deleteRowAt(1, 1);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+</table>
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteTbodyExpand1-ref.html b/layout/reftests/table-dom/deleteTbodyExpand1-ref.html
new file mode 100644
index 0000000000..2f11cfdedd
--- /dev/null
+++ b/layout/reftests/table-dom/deleteTbodyExpand1-ref.html
@@ -0,0 +1,31 @@
+<HEAD>
+</HEAD>
+<BODY>
+
+<table bgcolor=orange border>
+ <tbody>
+ <tr>
+ <td>c31</td><td>c32</td>
+ </tr>
+ <tr>
+ <td>c41</td><td>c42</td>
+ </tr>
+ </tbody>
+</table>
+<table bgcolor=orange border>
+ <tbody>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+ </tbody>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteTbodyExpand1.html b/layout/reftests/table-dom/deleteTbodyExpand1.html
new file mode 100644
index 0000000000..09cf75fc3a
--- /dev/null
+++ b/layout/reftests/table-dom/deleteTbodyExpand1.html
@@ -0,0 +1,55 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ deleteTbodyAt(0, 0);
+ deleteTbodyAt(1, 1);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tbody>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+ </tbody>
+ <tbody>
+ <tr>
+ <td>c31</td><td>c32</td>
+ </tr>
+ <tr>
+ <td>c41</td><td>c42</td>
+ </tr>
+ </tbody>
+</table>
+<table bgcolor=orange border>
+ <tbody>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+ </tbody>
+ <tbody>
+ <tr>
+ <td>c31</td><td>c32</td>
+ </tr>
+ <tr>
+ <td>c41</td><td>c42</td>
+ </tr>
+ </tbody>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteTbodyRebuild1-ref.html b/layout/reftests/table-dom/deleteTbodyRebuild1-ref.html
new file mode 100644
index 0000000000..9a2a66f236
--- /dev/null
+++ b/layout/reftests/table-dom/deleteTbodyRebuild1-ref.html
@@ -0,0 +1,20 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <tbody>
+ <tr>
+ <td>c31</td><td>c32</td>
+ </tr>
+ <tr>
+ <td>c41</td><td>c42</td>
+ </tr>
+ </tbody>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/deleteTbodyRebuild1.html b/layout/reftests/table-dom/deleteTbodyRebuild1.html
new file mode 100644
index 0000000000..f0052607ea
--- /dev/null
+++ b/layout/reftests/table-dom/deleteTbodyRebuild1.html
@@ -0,0 +1,36 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ deleteTbodyAt(0, 0);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tbody>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+ <tr>
+ <td rowspan=2>c21</td><td>c22</td>
+ </tr>
+ </tbody>
+ <tbody>
+ <tr>
+ <td>c31</td><td>c32</td>
+ </tr>
+ <tr>
+ <td>c41</td><td>c42</td>
+ </tr>
+ </tbody>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/insertCaptionsAndRows1-ref.html b/layout/reftests/table-dom/insertCaptionsAndRows1-ref.html
new file mode 100644
index 0000000000..e7ec45d142
--- /dev/null
+++ b/layout/reftests/table-dom/insertCaptionsAndRows1-ref.html
@@ -0,0 +1,16 @@
+<html>
+<head>
+
+<style>
+ caption { color: green }
+</style>
+
+</head>
+<body>
+<table id="table">
+<tbody><tr><td>a new row 1</td></tr></tbody>
+<caption>this is the caption</caption>
+<tbody><tr><td>a new row 2</td></tr></tbody>
+</table>
+</body>
+</html>
diff --git a/layout/reftests/table-dom/insertCaptionsAndRows1.html b/layout/reftests/table-dom/insertCaptionsAndRows1.html
new file mode 100644
index 0000000000..8e86057b44
--- /dev/null
+++ b/layout/reftests/table-dom/insertCaptionsAndRows1.html
@@ -0,0 +1,45 @@
+<html class="reftest-wait">
+<head>
+
+<style>
+ caption { color: green }
+</style>
+
+<script>
+function boom()
+{
+ document.body.offsetHeight;
+
+ var table = document.getElementById("table");
+
+ var newtbody = document.createElement("tbody");
+ var newrow = document.createElement("tr");
+ var newcell = document.createElement("td");
+ newcell.appendChild(document.createTextNode("a new row 2"));
+ newrow.appendChild(newcell);
+ newtbody.appendChild(newrow);
+ table.insertBefore(newtbody, table.firstChild);
+
+ var caption = document.createElement("caption");
+ caption.appendChild(document.createTextNode("this is the caption"));
+ table.insertBefore(caption, table.firstChild);
+
+ newtbody = document.createElement("tbody");
+ newrow = document.createElement("tr");
+ newcell = document.createElement("td");
+ newcell.appendChild(document.createTextNode("a new row 1"));
+ newrow.appendChild(newcell);
+ newtbody.appendChild(newrow);
+ table.insertBefore(newtbody, table.firstChild);
+
+ document.body.offsetHeight;
+ document.documentElement.className = "";
+}
+</script>
+
+</head>
+<body onload="boom();">
+<table id="table">
+</table>
+</body>
+</html>
diff --git a/layout/reftests/table-dom/insertCaptionsAndRows2-ref.html b/layout/reftests/table-dom/insertCaptionsAndRows2-ref.html
new file mode 100644
index 0000000000..dc95e6e675
--- /dev/null
+++ b/layout/reftests/table-dom/insertCaptionsAndRows2-ref.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+
+<style>
+ caption { color: green }
+</style>
+
+</head>
+<body>
+<table id="table">
+<caption>this is the caption</caption>
+<tbody><tr><td>a new row 1</td></tr></tbody>
+<tbody><tr><td>a new row 2</td></tr></tbody>
+<tbody>
+<tr><td>a row</td></tr>
+</tbody>
+</table>
+</body>
+</html>
diff --git a/layout/reftests/table-dom/insertCaptionsAndRows2.html b/layout/reftests/table-dom/insertCaptionsAndRows2.html
new file mode 100644
index 0000000000..a73e5758cb
--- /dev/null
+++ b/layout/reftests/table-dom/insertCaptionsAndRows2.html
@@ -0,0 +1,46 @@
+<html class="reftest-wait">
+<head>
+
+<style>
+ caption { color: green }
+</style>
+
+<script>
+function boom()
+{
+ document.body.offsetHeight;
+
+ var table = document.getElementById("table");
+
+ var newtbody = document.createElement("tbody");
+ var newrow = document.createElement("tr");
+ var newcell = document.createElement("td");
+ newcell.appendChild(document.createTextNode("a new row 2"));
+ newrow.appendChild(newcell);
+ newtbody.appendChild(newrow);
+ table.insertBefore(newtbody, table.firstChild);
+
+ var caption = document.createElement("caption");
+ caption.appendChild(document.createTextNode("this is the caption"));
+ table.insertBefore(caption, table.firstChild);
+
+ newtbody = document.createElement("tbody");
+ newrow = document.createElement("tr");
+ newcell = document.createElement("td");
+ newcell.appendChild(document.createTextNode("a new row 1"));
+ newrow.appendChild(newcell);
+ newtbody.appendChild(newrow);
+ table.insertBefore(newtbody, table.firstChild);
+
+ document.body.offsetHeight;
+ document.documentElement.className = "";
+}
+</script>
+
+</head>
+<body onload="boom();">
+<table id="table"><tbody>
+<tr><td>a row</td></tr>
+</tbody></table>
+</body>
+</html>
diff --git a/layout/reftests/table-dom/insertCaptionsAndRows3-ref.html b/layout/reftests/table-dom/insertCaptionsAndRows3-ref.html
new file mode 100644
index 0000000000..213d413066
--- /dev/null
+++ b/layout/reftests/table-dom/insertCaptionsAndRows3-ref.html
@@ -0,0 +1,18 @@
+<html>
+<head>
+
+<style>
+ caption { color: green }
+</style>
+
+</head>
+<body>
+<table id="table">
+<tbody><tr><td>a new row 1</td></tr></tbody>
+<caption>this is the caption</caption>
+<tbody><tr><td>a new row 2</td></tr></tbody>
+<caption>this is a caption that you shouldn't see</caption>
+<tbody><tr><td>a row</td></tr></tbody>
+</table>
+</body>
+</html>
diff --git a/layout/reftests/table-dom/insertCaptionsAndRows3.html b/layout/reftests/table-dom/insertCaptionsAndRows3.html
new file mode 100644
index 0000000000..02bcaa8ea8
--- /dev/null
+++ b/layout/reftests/table-dom/insertCaptionsAndRows3.html
@@ -0,0 +1,48 @@
+<html class="reftest-wait">
+<head>
+
+<style>
+ caption { color: green }
+</style>
+
+<script>
+function boom()
+{
+ document.body.offsetHeight;
+
+ var table = document.getElementById("table");
+ var cap = document.getElementById("cap");
+
+ var newtbody = document.createElement("tbody");
+ var newrow = document.createElement("tr");
+ var newcell = document.createElement("td");
+ newcell.appendChild(document.createTextNode("a new row 1"));
+ newrow.appendChild(newcell);
+ newtbody.appendChild(newrow);
+ table.insertBefore(newtbody, cap);
+
+ var caption = document.createElement("caption");
+ caption.appendChild(document.createTextNode("this is the caption"));
+ table.insertBefore(caption, cap);
+
+ newtbody = document.createElement("tbody");
+ newrow = document.createElement("tr");
+ newcell = document.createElement("td");
+ newcell.appendChild(document.createTextNode("a new row 2"));
+ newrow.appendChild(newcell);
+ newtbody.appendChild(newrow);
+ table.insertBefore(newtbody, cap);
+
+ document.body.offsetHeight;
+ document.documentElement.className = "";
+}
+</script>
+
+</head>
+<body onload="boom();">
+<table id="table">
+<caption id="cap">this is a caption that you shouldn't see</caption>
+<tbody><tr><td>a row</td></tr></tbody>
+</table>
+</body>
+</html>
diff --git a/layout/reftests/table-dom/insertCaptionsAndRows4-ref.html b/layout/reftests/table-dom/insertCaptionsAndRows4-ref.html
new file mode 100644
index 0000000000..7d42b3e336
--- /dev/null
+++ b/layout/reftests/table-dom/insertCaptionsAndRows4-ref.html
@@ -0,0 +1,18 @@
+<html>
+<head>
+
+<style>
+ caption { color: green }
+</style>
+
+</head>
+<body>
+<table id="table">
+<caption>this is the caption</caption>
+<tbody><tr><td>a new row 1</td></tr></tbody>
+<caption>this is a caption that you shouldn't see</caption>
+<tbody><tr><td>a new row 2</td></tr></tbody>
+<tbody><tr><td>a row</td></tr></tbody>
+</table>
+</body>
+</html>
diff --git a/layout/reftests/table-dom/insertCaptionsAndRows4.html b/layout/reftests/table-dom/insertCaptionsAndRows4.html
new file mode 100644
index 0000000000..8413ffd9fd
--- /dev/null
+++ b/layout/reftests/table-dom/insertCaptionsAndRows4.html
@@ -0,0 +1,48 @@
+<html class="reftest-wait">
+<head>
+
+<style>
+ caption { color: green }
+</style>
+
+<script>
+function boom()
+{
+ document.body.offsetHeight;
+
+ var table = document.getElementById("table");
+ var tbody = document.getElementById("tbody");
+
+ var newtbody = document.createElement("tbody");
+ var newrow = document.createElement("tr");
+ var newcell = document.createElement("td");
+ newcell.appendChild(document.createTextNode("a new row 1"));
+ newrow.appendChild(newcell);
+ newtbody.appendChild(newrow);
+ table.insertBefore(newtbody, tbody);
+
+ var caption = document.createElement("caption");
+ caption.appendChild(document.createTextNode("this is a caption that you shouldn't see"));
+ table.insertBefore(caption, tbody);
+
+ newtbody = document.createElement("tbody");
+ newrow = document.createElement("tr");
+ newcell = document.createElement("td");
+ newcell.appendChild(document.createTextNode("a new row 2"));
+ newrow.appendChild(newcell);
+ newtbody.appendChild(newrow);
+ table.insertBefore(newtbody, tbody);
+
+ document.body.offsetHeight;
+ document.documentElement.className = "";
+}
+</script>
+
+</head>
+<body onload="boom();">
+<table id="table">
+<caption>this is the caption</caption>
+<tbody id="tbody"><tr><td>a row</td></tr></tbody>
+</table>
+</body>
+</html>
diff --git a/layout/reftests/table-dom/insertCellsExpand1-ref.html b/layout/reftests/table-dom/insertCellsExpand1-ref.html
new file mode 100644
index 0000000000..f254cf6ee0
--- /dev/null
+++ b/layout/reftests/table-dom/insertCellsExpand1-ref.html
@@ -0,0 +1,18 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>X2</td><td>X1</td><td>c12</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>X4</td><td>X3</td><td>c22</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/insertCellsExpand1.html b/layout/reftests/table-dom/insertCellsExpand1.html
new file mode 100644
index 0000000000..3d62bd26a4
--- /dev/null
+++ b/layout/reftests/table-dom/insertCellsExpand1.html
@@ -0,0 +1,29 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ insertCellAt(0, 1, 1, 1);
+ insertCellAt(0, 1, 1, 1);
+ insertCellAt(1, 1, 1, 1);
+ insertCellAt(1, 1, 1, 1);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/insertCellsExpand2-ref.html b/layout/reftests/table-dom/insertCellsExpand2-ref.html
new file mode 100644
index 0000000000..d701d01867
--- /dev/null
+++ b/layout/reftests/table-dom/insertCellsExpand2-ref.html
@@ -0,0 +1,21 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td rowspan=2 colspan=2>X1</td><td>c12</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+ <tr>
+ <td>c31</td><td>c32</td><td>c33</td><td>c34</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/insertCellsExpand2.html b/layout/reftests/table-dom/insertCellsExpand2.html
new file mode 100644
index 0000000000..2330aed1d7
--- /dev/null
+++ b/layout/reftests/table-dom/insertCellsExpand2.html
@@ -0,0 +1,29 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ insertCellAt(0, 1, 2, 2);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+ <tr>
+ <td>c31</td><td>c32</td><td>c33</td><td>c34</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/insertCellsExpandZeroRowspan-ref.html b/layout/reftests/table-dom/insertCellsExpandZeroRowspan-ref.html
new file mode 100644
index 0000000000..415b0ac0e7
--- /dev/null
+++ b/layout/reftests/table-dom/insertCellsExpandZeroRowspan-ref.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
+"http://www.w3.org/TR/REC-html40/strict.dtd">
+
+<HEAD>
+</HEAD>
+<BODY>
+
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>X2</td><td>X1</td><td rowspan ="0">c12</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>X4</td><td>X3</td>
+ </tr>
+<tr>
+ <td>c31</td>
+ </tr>
+
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/insertCellsExpandZeroRowspan.html b/layout/reftests/table-dom/insertCellsExpandZeroRowspan.html
new file mode 100644
index 0000000000..f30f7013b7
--- /dev/null
+++ b/layout/reftests/table-dom/insertCellsExpandZeroRowspan.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
+"http://www.w3.org/TR/REC-html40/strict.dtd">
+
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ insertCellAt(0, 1, 1, 1);
+ insertCellAt(0, 1, 1, 1);
+ insertCellAt(1, 1, 1, 1);
+ insertCellAt(1, 1, 1, 1);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td rowspan ="0">c12</td>
+ </tr>
+ <tr>
+ <td>c21</td>
+ </tr>
+ <tr>
+ <td>c31</td>
+ </tr>
+
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/insertCellsRebuild1-ref.html b/layout/reftests/table-dom/insertCellsRebuild1-ref.html
new file mode 100644
index 0000000000..92ef4210fc
--- /dev/null
+++ b/layout/reftests/table-dom/insertCellsRebuild1-ref.html
@@ -0,0 +1,34 @@
+<HEAD>
+
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td rowspan=2 colspan=2>X1</td><td>c12</td>
+ </tr>
+ <tr>
+ <td colspan=2>c21</td><td>c22</td>
+ </tr>
+ <tr>
+ <td>c31</td><td>c32</td><td>c33</td><td>c34</td>
+ </tr>
+</table>
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td><td rowspan=2>c13</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>X2</td><td>c22</td>
+ </tr>
+ <tr>
+ <td>c31</td><td>c32</td><td>c33</td>
+ </tr>
+</table>
+
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/insertCellsRebuild1.html b/layout/reftests/table-dom/insertCellsRebuild1.html
new file mode 100644
index 0000000000..c068abbe29
--- /dev/null
+++ b/layout/reftests/table-dom/insertCellsRebuild1.html
@@ -0,0 +1,41 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ insertCellAt(0, 1, 2, 2);
+ insertCellAt(4, 1, 1, 1);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+ <tr>
+ <td colspan=2>c21</td><td>c22</td>
+ </tr>
+ <tr>
+ <td>c31</td><td>c32</td><td>c33</td><td>c34</td>
+ </tr>
+</table>
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td><td rowspan=2>c13</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>c22</td>
+ </tr>
+ <tr>
+ <td>c31</td><td>c32</td><td>c33</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/insertCellsRebuild2-ref.html b/layout/reftests/table-dom/insertCellsRebuild2-ref.html
new file mode 100644
index 0000000000..1a5b1a79e4
--- /dev/null
+++ b/layout/reftests/table-dom/insertCellsRebuild2-ref.html
@@ -0,0 +1,22 @@
+<HEAD>
+</HEAD>
+<BODY>
+
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td><td>c12</td>
+ </tr>
+ <tr>
+ <td>c21</td><td>X1</td><td rowspan=2>c22</td><td>c22</td>
+ </tr>
+ <tr>
+ <td>c31</td><td>c32</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/insertCellsRebuild2.html b/layout/reftests/table-dom/insertCellsRebuild2.html
new file mode 100644
index 0000000000..a3c46b79e8
--- /dev/null
+++ b/layout/reftests/table-dom/insertCellsRebuild2.html
@@ -0,0 +1,31 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ insertCellAt(1, 1, 1, 1);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td><td>c12</td>
+ </tr>
+ <tr>
+ <td>c21</td><td rowspan=2>c22</td><td>c22</td>
+ </tr>
+ <tr>
+ <td>c31</td><td>c32</td>
+ </tr>
+</table>
+
+
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/insertCellsZeroColspan-ref.html b/layout/reftests/table-dom/insertCellsZeroColspan-ref.html
new file mode 100644
index 0000000000..d8a89c870c
--- /dev/null
+++ b/layout/reftests/table-dom/insertCellsZeroColspan-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
+"http://www.w3.org/TR/REC-html40/strict.dtd">
+<HEAD>
+
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+<tr>
+ <td>c11</td><td>c12</td><td>c13</td><td>c14</td>
+</tr>
+ <tr>
+ <td>c21</td><td colspan="0">X1</td>
+ </tr>
+</table>
+</BODY></HTML>
diff --git a/layout/reftests/table-dom/insertCellsZeroColspan.html b/layout/reftests/table-dom/insertCellsZeroColspan.html
new file mode 100644
index 0000000000..ddbfcc8309
--- /dev/null
+++ b/layout/reftests/table-dom/insertCellsZeroColspan.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
+"http://www.w3.org/TR/REC-html40/strict.dtd">
+<HEAD>
+
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+<tr>
+ <td>c11</td><td>c12</td><td>c13</td><td>c14</td>
+</tr>
+ <tr>
+ <td id="c21">c21</td>
+ </tr>
+</table>
+
+<script>
+document.body.offsetWidth;
+
+c21 = document.getElementById("c21");
+
+td = document.createElement("td");
+td.setAttribute("colspan", "0");
+td.appendChild(document.createTextNode("X1"));
+
+c21.parentNode.insertBefore(td, c21.nextSibling);
+</script>
+
+</BODY></HTML>
diff --git a/layout/reftests/table-dom/insertColGroups1-ref.html b/layout/reftests/table-dom/insertColGroups1-ref.html
new file mode 100644
index 0000000000..79fb5764b3
--- /dev/null
+++ b/layout/reftests/table-dom/insertColGroups1-ref.html
@@ -0,0 +1,19 @@
+<HEAD>
+</HEAD>
+<BODY>
+
+<table bgcolor=orange border>
+ <colgroup>
+ <col width=100>
+ <col width=200>
+ </colgroup>
+ <colgroup>
+ <col width=300>
+ </colgroup>
+ <tr>
+ <td>100</td><td>200</td><td>300</td>
+ </tr>
+</table>
+
+</BODY></HTML>
+
diff --git a/layout/reftests/table-dom/insertColGroups1.html b/layout/reftests/table-dom/insertColGroups1.html
new file mode 100644
index 0000000000..d57e6e435c
--- /dev/null
+++ b/layout/reftests/table-dom/insertColGroups1.html
@@ -0,0 +1,30 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var table = document.getElementsByTagName("TABLE")[0];
+ var refCg = document.getElementsByTagName("COLGROUP")[0];
+ var cg = document.createElement("COLGROUP", null);
+ var col = document.createElement("COL", null);
+ col.width = 100;
+ cg.appendChild(col);
+ col = document.createElement("COL", null);
+ col.width = 200;
+ cg.appendChild(col);
+ table.insertBefore(cg, refCg);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <colgroup>
+ <col width=300>
+ </colgroup>
+ <tr>
+ <td>100</td><td>200</td><td>300</td>
+ </tr>
+</table>
+</BODY></HTML>
+
diff --git a/layout/reftests/table-dom/insertColGroups2-ref.html b/layout/reftests/table-dom/insertColGroups2-ref.html
new file mode 100644
index 0000000000..875ed95507
--- /dev/null
+++ b/layout/reftests/table-dom/insertColGroups2-ref.html
@@ -0,0 +1,20 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <colgroup>
+ <col width=50>
+ </colgroup>
+ <colgroup>
+ <col width=100>
+ <col width=150>
+ </colgroup>
+ <colgroup>
+ <col width=200>
+ </colgroup>
+ <tr>
+ <td>50</td><td>100</td><td>150</td><td>200</td>
+ </tr>
+</table>
+</BODY></HTML>
+
diff --git a/layout/reftests/table-dom/insertColGroups2.html b/layout/reftests/table-dom/insertColGroups2.html
new file mode 100644
index 0000000000..91234f0d28
--- /dev/null
+++ b/layout/reftests/table-dom/insertColGroups2.html
@@ -0,0 +1,33 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var table = document.getElementsByTagName("TABLE")[0];
+ var refCg = document.getElementsByTagName("COLGROUP")[1];
+ var cg = document.createElement("COLGROUP", null);
+ var col = document.createElement("COL", null);
+ col.width = 100;
+ cg.appendChild(col);
+ col = document.createElement("COL", null);
+ col.width = 150;
+ cg.appendChild(col);
+ table.insertBefore(cg, refCg);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <colgroup>
+ <col width=50>
+ </colgroup>
+ <colgroup>
+ <col width=200>
+ </colgroup>
+ <tr>
+ <td>50</td><td>100</td><td>150</td><td>200</td>
+ </tr>
+</table>
+</BODY></HTML>
+
diff --git a/layout/reftests/table-dom/insertColgroupAndRowgroup-ref.html b/layout/reftests/table-dom/insertColgroupAndRowgroup-ref.html
new file mode 100644
index 0000000000..2d3cd87c83
--- /dev/null
+++ b/layout/reftests/table-dom/insertColgroupAndRowgroup-ref.html
@@ -0,0 +1,17 @@
+<html>
+<head>
+
+<style>
+ colgroup#s { width: 200px; }
+</style>
+
+</head>
+<body>
+<table border="1">
+<colgroup></colgroup>
+<colgroup id="s"></colgroup>
+<tbody><tr><td>cell 1,1</td><td>cell 1,2</td></tr></tbody>
+<tbody><tr><td>cell 2,1</td><td>cell 2,2</td></tr></tbody>
+</table>
+</body>
+</html>
diff --git a/layout/reftests/table-dom/insertColgroupAndRowgroup.html b/layout/reftests/table-dom/insertColgroupAndRowgroup.html
new file mode 100644
index 0000000000..abdf024cc8
--- /dev/null
+++ b/layout/reftests/table-dom/insertColgroupAndRowgroup.html
@@ -0,0 +1,43 @@
+<html class="reftest-wait">
+<head>
+
+<style>
+ colgroup#s { width: 200px; }
+</style>
+
+<script>
+function boom()
+{
+ document.body.offsetHeight;
+
+ var last = document.getElementById("last");
+ var parent = last.parentNode;
+
+ var colgroup = document.createElement("colgroup");
+ colgroup.setAttribute("id", "s");
+ parent.insertBefore(colgroup, last);
+
+ var newtbody = document.createElement("tbody");
+ var newrow = document.createElement("tr");
+ var newcell = document.createElement("td");
+ newcell.appendChild(document.createTextNode("cell 1,1"));
+ newrow.appendChild(newcell);
+ newcell = document.createElement("td");
+ newcell.appendChild(document.createTextNode("cell 1,2"));
+ newrow.appendChild(newcell);
+ newtbody.appendChild(newrow);
+ parent.insertBefore(newtbody, last);
+
+ document.body.offsetHeight;
+ document.documentElement.className = "";
+}
+</script>
+
+</head>
+<body onload="boom();">
+<table border="1">
+<colgroup></colgroup>
+<tbody id="last"><tr><td>cell 2,1</td><td>cell 2,2</td></tr></tbody>
+</table>
+</body>
+</html>
diff --git a/layout/reftests/table-dom/insertCols1-ref.html b/layout/reftests/table-dom/insertCols1-ref.html
new file mode 100644
index 0000000000..a4d281eed5
--- /dev/null
+++ b/layout/reftests/table-dom/insertCols1-ref.html
@@ -0,0 +1,13 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <col width=100>
+ <col width=200>
+ <col width=300>
+ <tr>
+ <td>100</td><td>200</td><td>300</td>
+ </tr>
+</table>
+</BODY></HTML>
+
diff --git a/layout/reftests/table-dom/insertCols1.html b/layout/reftests/table-dom/insertCols1.html
new file mode 100644
index 0000000000..44ee519312
--- /dev/null
+++ b/layout/reftests/table-dom/insertCols1.html
@@ -0,0 +1,25 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var refCol = document.getElementsByTagName("COL")[0];
+ var col = document.createElement("COL", null);
+ col.width = 100;
+ refCol.parentNode.insertBefore(col, refCol);
+ // HTML5 parser implies a colgroup around col, so this test
+ // case should really be XHTML
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <col width=200>
+ <col width=300>
+ <tr>
+ <td>100</td><td>200</td><td>300</td>
+ </tr>
+</table>
+</BODY></HTML>
+
diff --git a/layout/reftests/table-dom/insertCols2-ref.html b/layout/reftests/table-dom/insertCols2-ref.html
new file mode 100644
index 0000000000..a4d281eed5
--- /dev/null
+++ b/layout/reftests/table-dom/insertCols2-ref.html
@@ -0,0 +1,13 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <col width=100>
+ <col width=200>
+ <col width=300>
+ <tr>
+ <td>100</td><td>200</td><td>300</td>
+ </tr>
+</table>
+</BODY></HTML>
+
diff --git a/layout/reftests/table-dom/insertCols2.html b/layout/reftests/table-dom/insertCols2.html
new file mode 100644
index 0000000000..fe40640a5b
--- /dev/null
+++ b/layout/reftests/table-dom/insertCols2.html
@@ -0,0 +1,25 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var refCol = document.getElementsByTagName("COL")[1];
+ var col = document.createElement("COL", null);
+ col.width = 200;
+ refCol.parentNode.insertBefore(col, refCol);
+ // HTML5 parser implies a colgroup around col, so this test
+ // case should really be XHTML
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <col width=100>
+ <col width=300>
+ <tr>
+ <td>100</td><td>200</td><td>300</td>
+ </tr>
+</table>
+</BODY></HTML>
+
diff --git a/layout/reftests/table-dom/insertCols3-ref.html b/layout/reftests/table-dom/insertCols3-ref.html
new file mode 100644
index 0000000000..b0fa437fac
--- /dev/null
+++ b/layout/reftests/table-dom/insertCols3-ref.html
@@ -0,0 +1,14 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <col width=50>
+ <col width=100>
+ <col width=150>
+ <col width=200>
+ <tr>
+ <td>50</td><td>100</td><td>150</td><td>200</td>
+ </tr>
+</table>
+</BODY></HTML>
+
diff --git a/layout/reftests/table-dom/insertCols3.html b/layout/reftests/table-dom/insertCols3.html
new file mode 100644
index 0000000000..5b2e8a7fe6
--- /dev/null
+++ b/layout/reftests/table-dom/insertCols3.html
@@ -0,0 +1,26 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var refCol = document.getElementsByTagName("COL")[2];
+ var col = document.createElement("COL", null);
+ col.width = 150;
+ refCol.parentNode.insertBefore(col, refCol);
+ // HTML5 parser implies a colgroup around col, so this test
+ // case should really be XHTML
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <col width=50>
+ <col width=100>
+ <col width=200>
+ <tr>
+ <td>50</td><td>100</td><td>150</td><td>200</td>
+ </tr>
+</table>
+</BODY></HTML>
+
diff --git a/layout/reftests/table-dom/insertCols4-ref.html b/layout/reftests/table-dom/insertCols4-ref.html
new file mode 100644
index 0000000000..a380ff81fa
--- /dev/null
+++ b/layout/reftests/table-dom/insertCols4-ref.html
@@ -0,0 +1,15 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <colgroup>
+ <col width=100>
+ <col width=200>
+ <col width=300>
+ </colgroup>
+ <tr>
+ <td>100</td><td>200</td><td>300</td>
+ </tr>
+</table>
+</BODY></HTML>
+
diff --git a/layout/reftests/table-dom/insertCols4.html b/layout/reftests/table-dom/insertCols4.html
new file mode 100644
index 0000000000..183d5983b9
--- /dev/null
+++ b/layout/reftests/table-dom/insertCols4.html
@@ -0,0 +1,26 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var cg = document.getElementsByTagName("COLGROUP")[0];
+ var refCol = document.getElementsByTagName("COL")[0];
+ var col = document.createElement("COL", null);
+ col.width = 100;
+ cg.insertBefore(col, refCol);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <colgroup>
+ <col width=200>
+ <col width=300>
+ </colgroup>
+ <tr>
+ <td>100</td><td>200</td><td>300</td>
+ </tr>
+</table>
+</BODY></HTML>
+
diff --git a/layout/reftests/table-dom/insertCols5-ref.html b/layout/reftests/table-dom/insertCols5-ref.html
new file mode 100644
index 0000000000..a380ff81fa
--- /dev/null
+++ b/layout/reftests/table-dom/insertCols5-ref.html
@@ -0,0 +1,15 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <colgroup>
+ <col width=100>
+ <col width=200>
+ <col width=300>
+ </colgroup>
+ <tr>
+ <td>100</td><td>200</td><td>300</td>
+ </tr>
+</table>
+</BODY></HTML>
+
diff --git a/layout/reftests/table-dom/insertCols5.html b/layout/reftests/table-dom/insertCols5.html
new file mode 100644
index 0000000000..c06f272b21
--- /dev/null
+++ b/layout/reftests/table-dom/insertCols5.html
@@ -0,0 +1,26 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var cg = document.getElementsByTagName("COLGROUP")[0];
+ var refCol = document.getElementsByTagName("COL")[1];
+ var col = document.createElement("COL", null);
+ col.width = 200;
+ cg.insertBefore(col, refCol);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <colgroup>
+ <col width=100>
+ <col width=300>
+ </colgroup>
+ <tr>
+ <td>100</td><td>200</td><td>300</td>
+ </tr>
+</table>
+</BODY></HTML>
+
diff --git a/layout/reftests/table-dom/insertRowsExpand1-ref.html b/layout/reftests/table-dom/insertRowsExpand1-ref.html
new file mode 100644
index 0000000000..887247b796
--- /dev/null
+++ b/layout/reftests/table-dom/insertRowsExpand1-ref.html
@@ -0,0 +1,18 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <tr>
+ <td>X1</td><td>X2</td>
+ </tr>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/insertRowsExpand1.html b/layout/reftests/table-dom/insertRowsExpand1.html
new file mode 100644
index 0000000000..09f63dcff6
--- /dev/null
+++ b/layout/reftests/table-dom/insertRowsExpand1.html
@@ -0,0 +1,28 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var tbody = document.getElementsByTagName("TBODY")[0];
+ var row = document.createElement("TR", null);
+ appendCell(row, 1, 1);
+ appendCell(row, 1, 1);
+ var refRow = document.getElementsByTagName("TR")[0];
+ tbody.insertBefore(row, refRow);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/insertRowsRebuild1-ref.html b/layout/reftests/table-dom/insertRowsRebuild1-ref.html
new file mode 100644
index 0000000000..8290253322
--- /dev/null
+++ b/layout/reftests/table-dom/insertRowsRebuild1-ref.html
@@ -0,0 +1,18 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <tr>
+ <td rowspan=2>X1</td><td>X2</td>
+ </tr>
+ <tr>
+ <td rowspan=2>c11</td><td>c12</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/insertRowsRebuild1.html b/layout/reftests/table-dom/insertRowsRebuild1.html
new file mode 100644
index 0000000000..35a19cb38d
--- /dev/null
+++ b/layout/reftests/table-dom/insertRowsRebuild1.html
@@ -0,0 +1,28 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var tbody = document.getElementsByTagName("TBODY")[0];
+ var row = document.createElement("TR", null);
+ appendCell(row, 2, 1);
+ appendCell(row, 1, 1);
+ var refRow = document.getElementsByTagName("TR")[0];
+ tbody.insertBefore(row, refRow);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tr>
+ <td rowspan=2>c11</td><td>c12</td>
+ </tr>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/insertTbodyExpand1-ref.html b/layout/reftests/table-dom/insertTbodyExpand1-ref.html
new file mode 100644
index 0000000000..014ac663d3
--- /dev/null
+++ b/layout/reftests/table-dom/insertTbodyExpand1-ref.html
@@ -0,0 +1,23 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <tbody>
+ <tr>
+ <td>X1</td><td>X2</td>
+ </tr>
+ </tbody>
+ <tbody>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+ </tbody>
+</table>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/insertTbodyExpand1.html b/layout/reftests/table-dom/insertTbodyExpand1.html
new file mode 100644
index 0000000000..e0e3bad12b
--- /dev/null
+++ b/layout/reftests/table-dom/insertTbodyExpand1.html
@@ -0,0 +1,32 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var table = document.getElementsByTagName("TABLE")[0];
+ var tbody = document.createElement("TBODY", null);
+ var row = document.createElement("TR", null);
+ appendCell(row, 1, 1);
+ appendCell(row, 1, 1);
+ tbody.appendChild(row);
+ var refTbody = document.getElementsByTagName("TBODY")[0];
+ table.insertBefore(tbody, refTbody);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tbody>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+ </tbody>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/insertTbodyRebuild1-ref.html b/layout/reftests/table-dom/insertTbodyRebuild1-ref.html
new file mode 100644
index 0000000000..da5136e412
--- /dev/null
+++ b/layout/reftests/table-dom/insertTbodyRebuild1-ref.html
@@ -0,0 +1,23 @@
+<HEAD>
+</HEAD>
+<BODY>
+<table bgcolor=orange border>
+ <tbody>
+ <tr>
+ <td rowspan=2>X1</td><td>X2</td>
+ </tr>
+ </tbody>
+ <tbody>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+ </tbody>
+</table>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/insertTbodyRebuild1.html b/layout/reftests/table-dom/insertTbodyRebuild1.html
new file mode 100644
index 0000000000..b79e75dd59
--- /dev/null
+++ b/layout/reftests/table-dom/insertTbodyRebuild1.html
@@ -0,0 +1,32 @@
+<HEAD>
+<SCRIPT src=tableDom.js>
+</SCRIPT>
+<SCRIPT>
+
+function doIt() {
+ var table = document.getElementsByTagName("TABLE")[0];
+ var tbody = document.createElement("TBODY", null);
+ var row = document.createElement("TR", null);
+ appendCell(row, 2, 1);
+ appendCell(row, 1, 1);
+ tbody.appendChild(row);
+ var refTbody = document.getElementsByTagName("TBODY")[0];
+ table.insertBefore(tbody, refTbody);
+}
+</SCRIPT>
+</HEAD>
+<BODY onload="doIt()">
+<table bgcolor=orange border>
+ <tbody>
+ <tr>
+ <td>c11</td><td>c12</td>
+ </tr>
+ </tbody>
+</table>
+</BODY></HTML>
+
+
+
+
+
+
diff --git a/layout/reftests/table-dom/reftest.list b/layout/reftests/table-dom/reftest.list
new file mode 100644
index 0000000000..f1a3e47738
--- /dev/null
+++ b/layout/reftests/table-dom/reftest.list
@@ -0,0 +1,44 @@
+== appendCells1.html appendCells1-ref.html
+== appendCellsRebuild1.html appendCellsRebuild1-ref.html
+== appendCellsZeroColspan.html appendCellsZeroColspan-ref.html
+== appendCol1.html appendCol1-ref.html
+== appendCol2.html appendCol2-ref.html
+== appendColGroup1.html appendColGroup1-ref.html
+== appendRowsExpand1.html appendRowsExpand1-ref.html
+== appendTbodyExpand1.html appendTbodyExpand1-ref.html
+== deleteCellsRebuild1.html deleteCellsRebuild1-ref.html
+== deleteCellsShrink1.html deleteCellsShrink1-ref.html
+== deleteCellsShrink2.html deleteCellsShrink2-ref.html
+== deleteCellsExpandZeroColspan.html deleteCellsExpandZeroColspan-ref.html
+== deleteCol1.html deleteCol1-ref.html
+== deleteCol2.html deleteCol2-ref.html
+== deleteCol3.html deleteCol3-ref.html
+== deleteColGroup1.html deleteColGroup1-ref.html
+== deleteColGroup2.html deleteColGroup2-ref.html
+== deleteRowsRebuild1.html deleteRowsRebuild1-ref.html
+== deleteRowsRebuild1a.html deleteRowsRebuild1a-ref.html
+== deleteRowsShrink1.html deleteRowsShrink1-ref.html
+== deleteTbodyExpand1.html deleteTbodyExpand1-ref.html
+== deleteTbodyRebuild1.html deleteTbodyRebuild1-ref.html
+== insertCaptionsAndRows1.html insertCaptionsAndRows1-ref.html
+== insertCaptionsAndRows2.html insertCaptionsAndRows2-ref.html
+== insertCaptionsAndRows3.html insertCaptionsAndRows3-ref.html
+== insertCaptionsAndRows4.html insertCaptionsAndRows4-ref.html
+== insertCellsExpand1.html insertCellsExpand1-ref.html
+== insertCellsExpand2.html insertCellsExpand2-ref.html
+== insertCellsExpandZeroRowspan.html insertCellsExpandZeroRowspan-ref.html
+== insertCellsRebuild1.html insertCellsRebuild1-ref.html
+== insertCellsRebuild2.html insertCellsRebuild2-ref.html
+== insertCellsZeroColspan.html insertCellsZeroColspan-ref.html
+== insertColGroups1.html insertColGroups1-ref.html
+== insertColGroups2.html insertColGroups2-ref.html
+== insertColgroupAndRowgroup.html insertColgroupAndRowgroup-ref.html
+== insertCols1.html insertCols1-ref.html
+== insertCols2.html insertCols2-ref.html
+== insertCols3.html insertCols3-ref.html
+== insertCols4.html insertCols4-ref.html
+== insertCols5.html insertCols5-ref.html
+== insertRowsExpand1.html insertRowsExpand1-ref.html
+== insertRowsRebuild1.html insertRowsRebuild1-ref.html
+== insertTbodyExpand1.html insertTbodyExpand1-ref.html
+== insertTbodyRebuild1.html insertTbodyRebuild1-ref.html
diff --git a/layout/reftests/table-dom/tableDom.js b/layout/reftests/table-dom/tableDom.js
new file mode 100644
index 0000000000..4caa43d6e5
--- /dev/null
+++ b/layout/reftests/table-dom/tableDom.js
@@ -0,0 +1,129 @@
+/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 4 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+var count = 1;
+function genName(prefix) {
+ return "X" + count++ + "\n";
+}
+
+function appendCell(aRow, aRowSpan, aColSpan) {
+ var cell = document.createElement("TD", null);
+ cell.rowSpan = aRowSpan;
+ cell.colSpan = aColSpan;
+ var text = document.createTextNode(genName());
+ cell.appendChild(text);
+ aRow.appendChild(cell);
+}
+
+function appendCellAt(aRowIndex, aRowSpan, aColSpan) {
+ var row = document.getElementsByTagName("TR")[aRowIndex];
+ appendCell(row, aRowSpan, aColSpan);
+}
+
+function insertCell(aRow, aColIndex, aRowSpan, aColSpan) {
+ var cells = aRow.cells;
+ var refCell = cells.item(aColIndex);
+ var newCell = document.createElement("TD", null);
+ newCell.rowSpan = aRowSpan;
+ newCell.colSpan = aColSpan;
+ var text = document.createTextNode(genName());
+ newCell.appendChild(text);
+ aRow.insertBefore(newCell, refCell);
+ //dump("SCRIPT: inserted CELL as first cell in first row\n");
+}
+
+function insertCellAt(aRowIndex, aColIndex, aRowSpan, aColSpan) {
+ var row = document.getElementsByTagName("TR")[aRowIndex];
+ insertCell(row, aColIndex, aRowSpan, aColSpan);
+}
+
+function deleteCell(aRow, aColIndex) {
+ aRow.deleteCell(aColIndex);
+}
+
+function deleteCellAt(aRowIndex, aColIndex) {
+ var row = document.getElementsByTagName("TR")[aRowIndex];
+ deleteCell(row, aColIndex);
+}
+
+//function appendRow(aRowGroup) {
+// var row = document.createElement("TR", null);
+// cell = document.createElement("TD", null);
+// row.appendChild(cell);
+// aRowGroup.appendChild(row);
+//}
+
+function appendRow(aRowGroup) {
+ var row = document.createElement("TR", null);
+ cell = document.createElement("TD", null);
+ aRowGroup.appendChild(row);
+ //row.appendChild(cell);
+ //appendCell(row, 1, 1);
+}
+
+function appendRowAt(aRowGroupIndex) {
+ var rowGroup = document.getElementsByTagName("TBODY")[aRowGroupIndex];
+ appendRow(rowGroup);
+}
+
+function insertRow(aRowGroup, aRowIndex) {
+ var rows = aRowGroup.rows;
+ var refRow = rows.item(aRowIndex);
+ var row = document.createElement("TR", null);
+ aRowGroup.insertBefore(row, refRow);
+ //appendCell(row, 1, 1);
+}
+
+function insertRowAt(aRowGroupIndex, aRowIndex) {
+ var rowGroup = document.getElementsByTagName("TBODY")[aRowGroupIndex];
+ insertRow(rowGroup, aRowIndex);
+}
+
+function deleteRow(aRowGroup, aRowIndex) {
+ aRowGroup.deleteRow(aRowIndex);
+}
+
+function deleteRowAt(aRowGroupIndex, aRowIndex) {
+ var row = document.getElementsByTagName("TBODY")[aRowGroupIndex];
+ deleteRow(row, aRowIndex);
+}
+
+function insertTbody(aTable, aTbodyIndex) {
+ var tbodies = aTable.tBodies;
+ var refTbody = tbodies.item(aTbodyIndex);
+ var tbody = document.createElement("TBODY", null);
+ aTable.insertBefore(tbody, refTbody);
+}
+
+function insertTbodyAt(aTableIndex, aTbodyIndex) {
+ var table = document.getElementsByTagName("TABLE")[aTableIndex];
+ insertTbodyAt(table, aTbodyIndex);
+}
+
+function deleteTbody(aTable, aTbodyIndex) {
+ var tbodies = aTable.tBodies;
+ var tbody = tbodies.item(aTbodyIndex);
+ aTable.removeChild(tbody);
+}
+
+function deleteTbodyAt(aTableIndex, aTbodyIndex) {
+ var table = document.getElementsByTagName("TABLE")[aTableIndex];
+ deleteTbody(table, aTbodyIndex);
+}
+
+function buildTable(aNumRows, aNumCols) {
+ var table = document.getElementsByTagName("TABLE")[0];
+ for (rowX = 0; rowX < aNumRows; rowX++) {
+ var row = document.createElement("TR", null);
+ for (colX = 0; colX < aNumCols; colX++) {
+ var cell = document.createElement("TD", null);
+ var text = document.createTextNode(genName());
+ cell.appendChild(text);
+ row.appendChild(cell);
+ }
+ table.appendChild(row);
+ }
+}
+