blob: 388e44d0c00b1742e64585347e28c19956882508 [file] [log] [blame] [edit]
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/tabular-data.html#dom-tbody-insertrow">
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<script>
description("Tests that HTMLTableSectionElement.insertRow() skips non &lt;tr&gt; children.");
var tb = document.createElement("tbody");
shouldBe("tb.__proto__", "HTMLTableSectionElement.prototype");
tb.appendChild(new Text("TEXT"));
tb.appendChild(document.createElement("a"));
tb.insertRow(-1).innerHTML = "1";
// The insertRow() method must create a tr element, insert it as a child of the
// table section element, immediately before the indexth tr element in the rows
// collection, and finally must return the newly created tr element.
tb.insertRow(0).innerHTML = "0";
var childNodes = tb.childNodes;
shouldBe("childNodes.length", "4");
shouldBeEqualToString("childNodes[0].nodeValue", "TEXT");
shouldBeEqualToString("childNodes[1].tagName", "A");
shouldBeEqualToString("childNodes[2].innerHTML", "0");
shouldBeEqualToString("childNodes[3].innerHTML", "1");
</script>
</body>
</html>