Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/tabular-data/the-table-element/table-rows-live-move.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>HTMLCollection (table.rows) liveness after moving rows</title>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<table id="testTable">
<tbody>
<tr><td>Cell 1</td></tr>
<tr><td>Cell 2</td></tr>
</tbody>
</table>
<script>
"use strict";
test(() => {
const table = document.getElementById("testTable");
const tbody = table.tBodies[0];
const { rows } = table;
assert_equals(rows[0].cells[0].textContent, "Cell 1");
const row1 = rows[0];
tbody.removeChild(row1);
tbody.appendChild(row1);
assert_equals(rows[0].cells[0].textContent, "Cell 2");
const len = rows.length;
assert_equals(len, 2);
assert_equals(rows[0].cells[0].textContent, "Cell 2");
}, "table.rows should reflect row moves immediately");
</script>