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-tr-element/rowIndex.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>HTMLTableRowElement.rowIndex</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(function() {
var row = document.createElement("table")
.appendChild(document.createElement("div"))
.appendChild(document.createElement("tr"));
assert_equals(row.rowIndex, -1);
});
test(function() {
var row = document.createElement("table")
.appendChild(document.createElement("thead"))
.appendChild(document.createElement("tr"));
assert_equals(row.rowIndex, 0);
});
test(function() {
var row = document.createElement("table")
.appendChild(document.createElement("tbody"))
.appendChild(document.createElement("tr"));
assert_equals(row.rowIndex, 0);
});
test(function() {
var row = document.createElement("table")
.appendChild(document.createElement("tfoot"))
.appendChild(document.createElement("tr"));
assert_equals(row.rowIndex, 0);
});
test(function() {
var row = document.createElement("table")
.appendChild(document.createElement("tr"));
assert_equals(row.rowIndex, 0);
});
test(function() {
var row = document.createElementNS("", "table")
.appendChild(document.createElement("thead"))
.appendChild(document.createElement("tr"));
assert_equals(row.rowIndex, -1);
});
test(function() {
var row = document.createElementNS("", "table")
.appendChild(document.createElement("tbody"))
.appendChild(document.createElement("tr"));
assert_equals(row.rowIndex, -1);
});
test(function() {
var row = document.createElementNS("", "table")
.appendChild(document.createElement("tfoot"))
.appendChild(document.createElement("tr"));
assert_equals(row.rowIndex, -1);
});
test(function() {
var row = document.createElementNS("", "table")
.appendChild(document.createElement("tr"));
assert_equals(row.rowIndex, -1);
});
test(function() {
var row = document.createElement("table")
.appendChild(document.createElementNS("", "thead"))
.appendChild(document.createElement("tr"));
assert_equals(row.rowIndex, -1);
});
test(function() {
var row = document.createElement("table")
.appendChild(document.createElementNS("", "tbody"))
.appendChild(document.createElement("tr"));
assert_equals(row.rowIndex, -1);
});
test(function() {
var row = document.createElement("table")
.appendChild(document.createElementNS("", "tfoot"))
.appendChild(document.createElement("tr"));
assert_equals(row.rowIndex, -1);
});
</script>