mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 07:18:39 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
|
|
@ -0,0 +1,50 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>HTMLTableCellElement.cellIndex</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var th = document.createElement("th");
|
||||
assert_true("cellIndex" in th, '"cellIndex" in th');
|
||||
var td = document.createElement("td");
|
||||
assert_true("cellIndex" in td, '"cellIndex" in td');
|
||||
}, "cellIndex should exist.")
|
||||
test(function() {
|
||||
var th = document.createElement("th");
|
||||
assert_equals(th.cellIndex, -1);
|
||||
var td = document.createElement("td");
|
||||
assert_equals(td.cellIndex, -1);
|
||||
}, "For cells without a parent, cellIndex should be -1.")
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var th = table.appendChild(document.createElement("th"));
|
||||
assert_equals(th.cellIndex, -1);
|
||||
var td = table.appendChild(document.createElement("td"));
|
||||
assert_equals(td.cellIndex, -1);
|
||||
}, "For cells whose parent is not a tr, cellIndex should be -1.")
|
||||
test(function() {
|
||||
var tr = document.createElementNS("", "tr");
|
||||
var th = tr.appendChild(document.createElement("th"));
|
||||
assert_equals(th.cellIndex, -1);
|
||||
var td = tr.appendChild(document.createElement("td"));
|
||||
assert_equals(td.cellIndex, -1);
|
||||
}, "For cells whose parent is not a HTML tr, cellIndex should be -1.")
|
||||
test(function() {
|
||||
var tr = document.createElement("tr");
|
||||
var th = tr.appendChild(document.createElement("th"));
|
||||
assert_equals(th.cellIndex, 0);
|
||||
var td = tr.appendChild(document.createElement("td"));
|
||||
assert_equals(td.cellIndex, 1);
|
||||
}, "For cells whose parent is a tr, cellIndex should be the index.")
|
||||
test(function() {
|
||||
var tr = document.createElement("tr");
|
||||
var th = tr.appendChild(document.createElement("th"));
|
||||
assert_equals(th.cellIndex, 0);
|
||||
tr.appendChild(document.createElement("div"));
|
||||
tr.appendChild(document.createTextNode("Hello World"));
|
||||
var td = tr.appendChild(document.createElement("td"));
|
||||
assert_equals(td.cellIndex, 1)
|
||||
}, "For cells whose parent is a tr with non td/th sibling, cellIndex should skip those non td/th siblings.")
|
||||
</script>
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!doctype html>
|
||||
<title>Historical table features should not be supported</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
function t(property, tagNames) {
|
||||
if (typeof tagNames === "string") {
|
||||
tagNames = [tagNames];
|
||||
}
|
||||
tagNames.forEach(function(tagName) {
|
||||
test(function() {
|
||||
assert_false(property in document.createElement(tagName));
|
||||
}, tagName + '.' + property + ' should not be supported');
|
||||
});
|
||||
}
|
||||
|
||||
// added in https://github.com/whatwg/html/commit/6db0d8d4e3456140de958c963afe9bb9ec7b6a25
|
||||
// removed in https://github.com/whatwg/html/commit/59b7e2466c2b7c5c408a4963b05b13fd808aa07a
|
||||
t('onsort', 'table');
|
||||
t('sortable', 'table');
|
||||
t('stopSorting', 'table');
|
||||
t('sorted', 'th');
|
||||
t('sort', 'th');
|
||||
</script>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
// https://html.spec.whatwg.org/multipage/#dom-tbody-rows
|
||||
function testRowsAttribute(localName) {
|
||||
var elem = document.createElement(localName);
|
||||
assert_equals(elem.rows.length, 0);
|
||||
|
||||
// Child <p> should *not* count as a row
|
||||
elem.appendChild(document.createElement("p"));
|
||||
assert_equals(elem.rows.length, 0);
|
||||
|
||||
// Child <tr> should count as a row
|
||||
var childTr = document.createElement("tr");
|
||||
elem.appendChild(childTr);
|
||||
assert_equals(elem.rows.length, 1);
|
||||
|
||||
// Nested table with child <tr> should *not* count as a row
|
||||
var nested = document.createElement(localName);
|
||||
nested.appendChild(document.createElement("tr"));
|
||||
var nestedTable = document.createElement("table");
|
||||
nestedTable.appendChild(nested);
|
||||
childTr.appendChild(nestedTable);
|
||||
assert_equals(elem.rows.length, 1);
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
[
|
||||
{
|
||||
"id": "forming-a-table",
|
||||
"original_id": "forming-a-table"
|
||||
},
|
||||
{
|
||||
"id": "header-and-data-cell-semantics",
|
||||
"original_id": "header-and-data-cell-semantics"
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML5 Table API Tests</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-caption-element" />
|
||||
</head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<table id="table1" style="display:none">
|
||||
<tr><td></td></tr>
|
||||
<caption>first caption</caption>
|
||||
<caption>second caption</caption>
|
||||
</table>
|
||||
<table id="table2" style="display:none">
|
||||
<tr><td></td></tr>
|
||||
</table>
|
||||
<table id="table3" style="display:none">
|
||||
<tr><td></td></tr>
|
||||
</table>
|
||||
<table id="table4" style="display:none">
|
||||
<tr><td></td></tr>
|
||||
<caption>first caption</caption>
|
||||
</table>
|
||||
<script>
|
||||
test(function () {
|
||||
assert_equals(document.getElementById('table1').caption.innerHTML, "first caption");
|
||||
}, "first caption element child of the first table element");
|
||||
|
||||
test(function () {
|
||||
var caption = document.createElement("caption");
|
||||
caption.innerHTML = "new caption";
|
||||
var table = document.getElementById('table1');
|
||||
table.caption = caption;
|
||||
|
||||
assert_equals(caption.parentNode, table);
|
||||
assert_equals(table.firstChild, caption);
|
||||
assert_equals(table.caption.innerHTML, "new caption");
|
||||
|
||||
captions = table.getElementsByTagName('caption');
|
||||
assert_equals(captions.length, 2);
|
||||
assert_equals(captions[0].innerHTML, "new caption");
|
||||
assert_equals(captions[1].innerHTML, "second caption");
|
||||
}, "setting caption on a table");
|
||||
|
||||
test(function () {
|
||||
assert_equals(document.getElementById('table2').caption, null);
|
||||
}, "caption IDL attribute is null");
|
||||
|
||||
test(function () {
|
||||
var table = document.getElementById('table3');
|
||||
var caption = document.createElement("caption")
|
||||
table.rows[0].appendChild(caption);
|
||||
assert_equals(table.caption, null);
|
||||
}, "caption of the third table element should be null");
|
||||
|
||||
test(function () {
|
||||
assert_not_equals(document.getElementById('table4').caption, null);
|
||||
|
||||
var parent = document.getElementById('table4').caption.parentNode;
|
||||
parent.removeChild(document.getElementById('table4').caption);
|
||||
|
||||
assert_equals(document.getElementById('table4').caption, null);
|
||||
}, "dynamically removing caption on a table");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Creating and deleting captions</title>
|
||||
<link rel="author" title="Erika Navara" href="mailto:edoyle@microsoft.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-table-element" />
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-table-createcaption" />
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-table-deletecaption" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<table id="table0" style="display:none">
|
||||
</table>
|
||||
<table id="table1" style="display:none">
|
||||
<caption id="caption1">caption</caption>
|
||||
<tr>
|
||||
<td>cell</td>
|
||||
<td>cell</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="table2" style="display:none">
|
||||
<foo:caption>caption</foo:caption>
|
||||
<tr>
|
||||
<td>cell</td>
|
||||
<td>cell</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="table3" style="display:none">
|
||||
<caption id="caption3">caption 3</caption>
|
||||
<tr>
|
||||
<td>cell</td>
|
||||
<td>cell</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="table4" style="display:none">
|
||||
</table>
|
||||
<table id="table5" style="display:none">
|
||||
</table>
|
||||
<script>
|
||||
test(function () {
|
||||
var table0 = document.getElementById('table0');
|
||||
var caption = document.createElementNS("foo", "caption");
|
||||
table0.appendChild(caption);
|
||||
var table0FirstNode = table0.firstChild;
|
||||
var testCaption = table0.createCaption();
|
||||
assert_not_equals(testCaption, table0FirstNode);
|
||||
assert_equals(testCaption, table0.firstChild);
|
||||
}, "createCaption method creates new caption if existing caption is not in html namespace")
|
||||
test(function () {
|
||||
var table1 = document.getElementById('table1');
|
||||
var testCaption = table1.createCaption();
|
||||
var table1FirstCaption = table1.caption;
|
||||
assert_equals(testCaption, table1FirstCaption);
|
||||
}, "createCaption method returns the first caption element child of the table")
|
||||
test(function () {
|
||||
var table2 = document.getElementById('table2');
|
||||
var test2Caption = table2.createCaption();
|
||||
var table2FirstNode = table2.firstChild;
|
||||
assert_true(test2Caption instanceof HTMLTableCaptionElement);
|
||||
assert_equals(table2FirstNode, test2Caption);
|
||||
}, "createCaption method creates a new caption and inserts it as the first node of the table element")
|
||||
test(function () {
|
||||
var table = document.createElement('table');
|
||||
assert_equals(table.createCaption(), table.createCaption());
|
||||
}, "createCaption will not create new caption if one exists")
|
||||
test(function () {
|
||||
var table = document.createElementNS("http://www.w3.org/1999/xhtml", "foo:table")
|
||||
var caption = table.createCaption();
|
||||
assert_equals(caption.prefix, null);
|
||||
}, "createCaption will not copy table's prefix")
|
||||
test(function () {
|
||||
var table3 = document.getElementById('table3');
|
||||
assert_equals(table3.caption.textContent, "caption 3");
|
||||
table3.deleteCaption();
|
||||
assert_equals(table3.caption, null);
|
||||
}, "deleteCaption method removes the first caption element child of the table element")
|
||||
test(function () {
|
||||
var table4 = document.getElementById('table4');
|
||||
var caption = document.createElementNS("foo", "caption");
|
||||
table4.appendChild(caption);
|
||||
table4.deleteCaption();
|
||||
assert_equals(caption.parentNode, table4);
|
||||
}, "deleteCaption method not remove caption that is not in html namespace")
|
||||
test(function() {
|
||||
var table5 = document.getElementById('table5');
|
||||
var caption = document.createElement('caption');
|
||||
caption.appendChild(table5)
|
||||
|
||||
// Node cannot be inserted at the specified point in the hierarchy
|
||||
assert_throws("HierarchyRequestError", function() {
|
||||
table5.caption = caption;
|
||||
});
|
||||
|
||||
assert_not_equals(table5.caption, caption);
|
||||
}, "Setting caption rethrows exception");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
[
|
||||
{
|
||||
"id": "table-descriptions-techniques",
|
||||
"original_id": "table-descriptions-techniques"
|
||||
},
|
||||
{
|
||||
"id": "table-layout-techniques",
|
||||
"original_id": "table-layout-techniques"
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,173 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>HTMLTableElement.createTBody</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
function assert_tbody(tbody) {
|
||||
assert_equals(tbody.localName, "tbody");
|
||||
assert_equals(tbody.namespaceURI, htmlNS);
|
||||
assert_equals(tbody.prefix, null);
|
||||
}
|
||||
var htmlNS = "http://www.w3.org/1999/xhtml";
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var tbody = table.createTBody();
|
||||
assert_equals(table.firstChild, tbody);
|
||||
assert_tbody(tbody);
|
||||
}, "No child nodes");
|
||||
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var before = table.appendChild(document.createElement("tbody"));
|
||||
assert_array_equals(table.childNodes, [before]);
|
||||
|
||||
var tbody = table.createTBody();
|
||||
assert_array_equals(table.childNodes, [before, tbody]);
|
||||
assert_tbody(tbody);
|
||||
}, "One tbody child node");
|
||||
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var before1 = table.appendChild(document.createElement("tbody"));
|
||||
var before2 = table.appendChild(document.createElement("tbody"));
|
||||
assert_array_equals(table.childNodes, [before1, before2]);
|
||||
|
||||
var tbody = table.createTBody();
|
||||
assert_array_equals(table.childNodes, [before1, before2, tbody]);
|
||||
assert_tbody(tbody);
|
||||
}, "Two tbody child nodes");
|
||||
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var before1 = table.appendChild(document.createElement("thead"));
|
||||
var before2 = table.appendChild(document.createElement("tbody"));
|
||||
assert_array_equals(table.childNodes, [before1, before2]);
|
||||
|
||||
var tbody = table.createTBody();
|
||||
assert_array_equals(table.childNodes, [before1, before2, tbody]);
|
||||
assert_tbody(tbody);
|
||||
}, "A thead and a tbody child node");
|
||||
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var before1 = table.appendChild(document.createElement("tfoot"));
|
||||
var before2 = table.appendChild(document.createElement("tbody"));
|
||||
assert_array_equals(table.childNodes, [before1, before2]);
|
||||
|
||||
var tbody = table.createTBody();
|
||||
assert_array_equals(table.childNodes, [before1, before2, tbody]);
|
||||
assert_tbody(tbody);
|
||||
}, "A tfoot and a tbody child node");
|
||||
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var before = table.appendChild(document.createElement("tbody"));
|
||||
var after = table.appendChild(document.createElement("thead"));
|
||||
assert_array_equals(table.childNodes, [before, after]);
|
||||
|
||||
var tbody = table.createTBody();
|
||||
assert_array_equals(table.childNodes, [before, tbody, after]);
|
||||
assert_tbody(tbody);
|
||||
}, "A tbody and a thead child node");
|
||||
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var before = table.appendChild(document.createElement("tbody"));
|
||||
var after = table.appendChild(document.createElement("tfoot"));
|
||||
assert_array_equals(table.childNodes, [before, after]);
|
||||
|
||||
var tbody = table.createTBody();
|
||||
assert_array_equals(table.childNodes, [before, tbody, after]);
|
||||
assert_tbody(tbody);
|
||||
}, "A tbody and a tfoot child node");
|
||||
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var before1 = table.appendChild(document.createElement("tbody"));
|
||||
var before2 = table.appendChild(document.createElement("tbody"));
|
||||
var after = table.appendChild(document.createElement("div"));
|
||||
assert_array_equals(table.childNodes, [before1, before2, after]);
|
||||
|
||||
var tbody = table.createTBody();
|
||||
assert_array_equals(table.childNodes, [before1, before2, tbody, after]);
|
||||
assert_tbody(tbody);
|
||||
}, "Two tbody child nodes and a div");
|
||||
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var before = table.appendChild(document.createElement("tbody"));
|
||||
var after = table.appendChild(document.createElementNS("x", "tbody"));
|
||||
assert_array_equals(table.childNodes, [before, after]);
|
||||
|
||||
var tbody = table.createTBody();
|
||||
assert_array_equals(table.childNodes, [before, tbody, after]);
|
||||
assert_tbody(tbody);
|
||||
}, "One HTML and one namespaced tbody child node");
|
||||
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var before1 = table.appendChild(document.createElement("tbody"));
|
||||
var before2 = before1.appendChild(document.createElement("tbody"));
|
||||
assert_array_equals(table.childNodes, [before1]);
|
||||
|
||||
var tbody = table.createTBody();
|
||||
assert_array_equals(table.childNodes, [before1, tbody]);
|
||||
assert_tbody(tbody);
|
||||
}, "Two nested tbody child nodes");
|
||||
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var before1 = table.appendChild(document.createElement("thead"));
|
||||
var before2 = before1.appendChild(document.createElement("tbody"));
|
||||
assert_array_equals(table.childNodes, [before1]);
|
||||
|
||||
var tbody = table.createTBody();
|
||||
assert_array_equals(table.childNodes, [before1, tbody]);
|
||||
assert_tbody(tbody);
|
||||
}, "A tbody node inside a thead child node");
|
||||
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var before1 = table.appendChild(document.createElement("tfoot"));
|
||||
var before2 = before1.appendChild(document.createElement("tbody"));
|
||||
assert_array_equals(table.childNodes, [before1]);
|
||||
|
||||
var tbody = table.createTBody();
|
||||
assert_array_equals(table.childNodes, [before1, tbody]);
|
||||
assert_tbody(tbody);
|
||||
}, "A tbody node inside a tfoot child node");
|
||||
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var before = table.appendChild(document.createElement("tbody"));
|
||||
var after1 = table.appendChild(document.createElement("thead"));
|
||||
var after2 = after1.appendChild(document.createElement("tbody"));
|
||||
assert_array_equals(table.childNodes, [before, after1]);
|
||||
|
||||
var tbody = table.createTBody();
|
||||
assert_array_equals(table.childNodes, [before, tbody, after1]);
|
||||
assert_tbody(tbody);
|
||||
}, "A tbody node inside a thead child node after a tbody child node");
|
||||
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var before = table.appendChild(document.createElement("tbody"));
|
||||
var after1 = table.appendChild(document.createElement("tfoot"));
|
||||
var after2 = after1.appendChild(document.createElement("tbody"));
|
||||
assert_array_equals(table.childNodes, [before, after1]);
|
||||
|
||||
var tbody = table.createTBody();
|
||||
assert_array_equals(table.childNodes, [before, tbody, after1]);
|
||||
assert_tbody(tbody);
|
||||
}, "A tbody node inside a tfoot child node after a tbody child node");
|
||||
|
||||
test(function() {
|
||||
var table = document.createElementNS(htmlNS, "foo:table");
|
||||
var tbody = table.createTBody();
|
||||
|
||||
assert_equals(tbody.prefix, null);
|
||||
}, "A prefixed table creates tbody without prefix");
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>deleteCaption()</title>
|
||||
<link rel="author" title="Ben Boyle" href="mailto:benjamins.boyle@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-table-deletecaption" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<table id="one-caption">
|
||||
<caption>Fixture table caption</caption>
|
||||
</table>
|
||||
|
||||
<table id="two-captions">
|
||||
<caption>Fixture table caption</caption>
|
||||
<caption>A second caption element</caption>
|
||||
</table>
|
||||
|
||||
<table id="zero-captions"></table>
|
||||
|
||||
<table id="descendent-caption">
|
||||
<tr>
|
||||
<td>
|
||||
<table>
|
||||
<caption>Nested caption</caption>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
// The deleteCaption() method must remove the first caption element child of the table element, if any.
|
||||
// https://html.spec.whatwgorg/multipage/tables.html#dom-table-deletecaption
|
||||
test(function() {
|
||||
var table = document.getElementById('one-caption');
|
||||
|
||||
table.deleteCaption();
|
||||
assert_equals(table.getElementsByTagName('caption').length, 0, 'caption was removed');
|
||||
|
||||
}, 'deleteCaption() delete only caption on table');
|
||||
|
||||
test(function() {
|
||||
var table = document.getElementById('one-caption');
|
||||
var result;
|
||||
|
||||
result = table.deleteCaption();
|
||||
// does .deleteCaption() have a return value?
|
||||
assert_equals(result, undefined, '.deleteCaption() returns undefined');
|
||||
}, 'deleteCaption() returns undefined');
|
||||
|
||||
test(function() {
|
||||
var table = document.getElementById('two-captions');
|
||||
|
||||
table.deleteCaption();
|
||||
assert_equals(table.getElementsByTagName('caption').length, 1, '1 caption (of 2) was removed');
|
||||
assert_equals(table.getElementsByTagName('caption')[0].textContent, 'A second caption element', 'The first caption was removed');
|
||||
|
||||
// removing the only caption
|
||||
table.deleteCaption();
|
||||
assert_equals(table.getElementsByTagName('caption').length, 0, 'last caption was removed');
|
||||
}, 'deleteCaption()');
|
||||
|
||||
test(function() {
|
||||
var table = document.getElementById('zero-captions');
|
||||
// removing a caption when none exists
|
||||
table.deleteCaption();
|
||||
|
||||
assert_equals(table.getElementsByTagName('caption').length, 0, 'no exceptions using .deleteCaption() on a table without any captions');
|
||||
|
||||
}, 'deleteCaption() does not throw any exceptions when called on a table without a caption');
|
||||
|
||||
test(function() {
|
||||
var table = document.getElementById( 'descendent-caption' );
|
||||
table.deleteCaption();
|
||||
|
||||
assert_equals(table.getElementsByTagName('caption').length, 1, 'descendent caption was not deleted');
|
||||
}, 'deleteCaption() does not delete captions in descendent tables');
|
||||
|
||||
test(function() {
|
||||
var table = document.getElementById('zero-captions');
|
||||
var caption;
|
||||
|
||||
caption = document.createElementNS('http://www.w3.org/2000/svg', 'caption');
|
||||
table.insertBefore(caption, table.firstChild);
|
||||
assert_equals(table.getElementsByTagName('caption').length, 1, 'SVG:caption is created');
|
||||
|
||||
table.deleteCaption();
|
||||
assert_equals(table.getElementsByTagName('caption').length, 1, 'SVG:caption is not deleted');
|
||||
|
||||
}, 'deleteCaption() handles captions from different namespaces');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<title>insertRow(): INDEX_SIZE_ERR</title>
|
||||
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-table-insertrow">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<div id="test">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
</table>
|
||||
</div>
|
||||
<script>
|
||||
test(function() {
|
||||
var table = document.getElementById("test").getElementsByTagName("table")[0];
|
||||
assert_throws("INDEX_SIZE_ERR", function() {
|
||||
table.insertRow(-2);
|
||||
})
|
||||
assert_throws("INDEX_SIZE_ERR", function() {
|
||||
table.insertRow(2);
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<title>insertRow(): Empty table</title>
|
||||
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-table-insertrow">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<div id="test">
|
||||
<table></table>
|
||||
</div>
|
||||
<script>
|
||||
var HTML = "http://www.w3.org/1999/xhtml";
|
||||
test(function() {
|
||||
var table = document.getElementById("test").getElementsByTagName("table")[0];
|
||||
test(function() {
|
||||
assert_equals(table.childNodes.length, 0);
|
||||
assert_equals(table.rows.length, 0);
|
||||
}, "table should start out empty")
|
||||
|
||||
var tr;
|
||||
test(function() {
|
||||
tr = table.insertRow(0);
|
||||
assert_equals(tr.localName, "tr");
|
||||
assert_equals(tr.namespaceURI, HTML);
|
||||
}, "insertRow should insert a tr element")
|
||||
|
||||
var tbody = tr.parentNode;
|
||||
test(function() {
|
||||
assert_equals(tbody.localName, "tbody");
|
||||
assert_equals(tbody.namespaceURI, HTML);
|
||||
assert_equals(tbody.parentNode, table);
|
||||
}, "insertRow should insert a tbody element")
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<title>insertRow(): non-empty table</title>
|
||||
<link rel="author" title="g-k" href="mailto:greg.guthe@gmail.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-table-insertrow">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<div id="test">
|
||||
<table>
|
||||
<tbody><tr id="first"></tr><tr id="second"></tr></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<script>
|
||||
var HTML = "http://www.w3.org/1999/xhtml";
|
||||
test(function() {
|
||||
var table = document.getElementById("test").getElementsByTagName("table")[0];
|
||||
test(function() {
|
||||
assert_equals(table.childNodes.length, 3);
|
||||
assert_equals(table.rows.length, 2);
|
||||
}, "table should start out with two rows")
|
||||
|
||||
var tr;
|
||||
test(function() {
|
||||
tr = table.insertRow(1);
|
||||
assert_equals(tr.localName, "tr");
|
||||
assert_equals(tr.namespaceURI, HTML);
|
||||
assert_equals(table.getElementsByTagName("tr")[0].id, "first");
|
||||
assert_equals(table.getElementsByTagName("tr")[1].id, "");
|
||||
assert_equals(table.getElementsByTagName("tr")[2].id, "second");
|
||||
}, "insertRow should insert a tr element before the second row")
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Delete Row tests</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<table id="element">
|
||||
<thead>
|
||||
<th>First column</th>
|
||||
<th>Second column</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1.1</td>
|
||||
<td>1.2</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2.1</td>
|
||||
<td>2.2</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
var el = document.getElementById('element');
|
||||
|
||||
test(function() {
|
||||
assert_throws("IndexSizeError", function() {
|
||||
el.deleteRow(-2)
|
||||
})
|
||||
}, 'deleteRow function invalid argument');
|
||||
test(function() {
|
||||
assert_throws("IndexSizeError", function() {
|
||||
el.deleteRow(el.rows.length)
|
||||
})
|
||||
}, 'deleteRow function invalid argument bis');
|
||||
|
||||
test(function() {
|
||||
var old_length = el.rows.length;
|
||||
el.insertRow(-1);
|
||||
el.deleteRow(-1);
|
||||
assert_equals(old_length, el.rows.length);
|
||||
}, "check normal deleteRow");
|
||||
test(function() {
|
||||
while (el.rows.length > 1) {
|
||||
el.deleteRow(-1);
|
||||
}
|
||||
assert_equals(1, el.rows.length);
|
||||
}, "check normal deleteRow bis");
|
||||
</script>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE html>
|
||||
<title>HTMLTableElement.tBodies</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var text =
|
||||
'<html xmlns="http://www.w3.org/1999/xhtml">' +
|
||||
' <head>' +
|
||||
' <title>Virtual Library</title>' +
|
||||
' </head>' +
|
||||
' <body>' +
|
||||
' <table id="mytable" border="1">' +
|
||||
' <tbody>' +
|
||||
' <tr><td>Cell 1</td><td>Cell 2</td></tr>' +
|
||||
' <tr><td>Cell 3</td><td>Cell 4</td></tr>' +
|
||||
' </tbody>' +
|
||||
' </table>' +
|
||||
' </body>' +
|
||||
'</html>';
|
||||
|
||||
var parser = new DOMParser();
|
||||
var doc = parser.parseFromString(text, "text/xml");
|
||||
|
||||
// import <table>
|
||||
var table = doc.documentElement.getElementsByTagName('table')[0];
|
||||
var mytable = document.body.appendChild(document.importNode(table, true));
|
||||
|
||||
assert_equals(mytable.tBodies.length, 1);
|
||||
var tbody = document.createElement('tbody');
|
||||
mytable.appendChild(tbody);
|
||||
var tr = tbody.insertRow(-1);
|
||||
tr.insertCell(-1).appendChild(document.createTextNode('Cell 5'));
|
||||
tr.insertCell(-1).appendChild(document.createTextNode('Cell 6'));
|
||||
assert_equals(mytable.tBodies.length, 2);
|
||||
assert_equals(mytable.rows.length, 3);
|
||||
assert_equals(tr.rowIndex, 2);
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>tFoot tests</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<table id="t">
|
||||
<caption id="tcaption"></caption><thead id="thead"></thead><tbody id="tbody1"></tbody><tbody id="tbody2"></tbody><tfoot id="tfoot1"></tfoot><tfoot id="tfoot2"></tfoot><tfoot id="tfoot3"></tfoot></table>
|
||||
<script>
|
||||
test(function() {
|
||||
var t = document.getElementById("t");
|
||||
var tfoot1 = document.getElementById("tfoot1");
|
||||
|
||||
assert_equals(t.tFoot, tfoot1);
|
||||
|
||||
var tfoot2 = document.getElementById("tfoot2");
|
||||
t.tFoot = null;
|
||||
|
||||
assert_equals(t.tFoot, tfoot2);
|
||||
|
||||
var tfoot3 = document.getElementById("tfoot3");
|
||||
t.deleteTFoot();
|
||||
|
||||
assert_equals(t.tFoot, tfoot3);
|
||||
|
||||
var tfoot = t.createTFoot();
|
||||
assert_equals(t.tFoot, tfoot);
|
||||
assert_equals(tfoot, tfoot3);
|
||||
|
||||
t.deleteTFoot();
|
||||
assert_equals(t.tFoot, null);
|
||||
|
||||
var tbody2 = document.getElementById("tbody2");
|
||||
|
||||
tfoot = t.createTFoot();
|
||||
assert_equals(t.tFoot, tfoot);
|
||||
|
||||
assert_equals(t.tFoot.previousSibling, tbody2);
|
||||
assert_equals(t.tFoot.nextSibling, null);
|
||||
|
||||
t.deleteTFoot();
|
||||
assert_equals(t.tFoot, null);
|
||||
|
||||
t.tFoot = tfoot;
|
||||
assert_equals(t.tFoot, tfoot);
|
||||
|
||||
assert_equals(t.tFoot.previousSibling, tbody2);
|
||||
assert_equals(t.tFoot.nextSibling, null);
|
||||
|
||||
assert_throws(new TypeError(), function(){
|
||||
t.tFoot = document.createElement("div");
|
||||
});
|
||||
|
||||
assert_throws("HierarchyRequestError", function(){
|
||||
t.tFoot = document.createElement("thead");
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>tHead tests</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<table id="t">
|
||||
<caption id="tcaption"></caption><thead id="thead1"></thead><thead id="thead2"></thead><thead id="thead3"></thead><tbody id="tbody1"></tbody><tbody id="tbody2"></tbody><tfoot id="tfoot"></tfoot>
|
||||
</table>
|
||||
<table>
|
||||
<thead id="t2thead">
|
||||
<td>
|
||||
<table id="t2">
|
||||
</table>
|
||||
</table>
|
||||
<script>
|
||||
test(function() {
|
||||
var t = document.getElementById("t");
|
||||
var thead1 = document.getElementById("thead1");
|
||||
|
||||
assert_equals(t.tHead, thead1);
|
||||
|
||||
var thead2 = document.getElementById("thead2");
|
||||
t.tHead = null;
|
||||
|
||||
assert_equals(t.tHead, thead2);
|
||||
|
||||
var thead3 = document.getElementById("thead3");
|
||||
t.deleteTHead();
|
||||
|
||||
assert_equals(t.tHead, thead3);
|
||||
|
||||
var thead = t.createTHead();
|
||||
assert_equals(t.tHead, thead);
|
||||
assert_equals(thead, thead3);
|
||||
|
||||
t.deleteTHead();
|
||||
assert_equals(t.tHead, null);
|
||||
|
||||
var tcaption = document.getElementById("tcaption");
|
||||
var tbody1 = document.getElementById("tbody1");
|
||||
|
||||
thead = t.createTHead();
|
||||
assert_equals(t.tHead, thead);
|
||||
|
||||
assert_equals(t.tHead.previousSibling, tcaption);
|
||||
assert_equals(t.tHead.nextSibling, tbody1);
|
||||
|
||||
assert_throws(new TypeError(), function(){
|
||||
t.tHead = document.createElement("div");
|
||||
});
|
||||
|
||||
assert_throws("HierarchyRequestError", function(){
|
||||
t.tHead = document.createElement("tbody");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
test(function() {
|
||||
var t2 = document.getElementById("t2");
|
||||
var t2thead = document.getElementById("t2thead");
|
||||
|
||||
assert_throws("HierarchyRequestError", function() {
|
||||
t2.tHead = t2thead;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>HTMLTableElement.insertRow</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var HTMLNS = "http://www.w3.org/1999/xhtml"
|
||||
var parentEl = document.createElementNS(HTMLNS, "html:table")
|
||||
assert_equals(parentEl.namespaceURI, HTMLNS, "Parent should be in the HTML namespace")
|
||||
assert_equals(parentEl.prefix, "html", "Parent prefix should be html")
|
||||
assert_equals(parentEl.localName, "table", "Parent local name should be table")
|
||||
assert_equals(parentEl.tagName, "HTML:TABLE", "Parent tag name should be HTML:TABLE")
|
||||
|
||||
var row = parentEl.insertRow(-1)
|
||||
assert_equals(row.namespaceURI, HTMLNS, "Row should be in the HTML namespace")
|
||||
assert_equals(row.prefix, null, "Row prefix should be null")
|
||||
assert_equals(row.localName, "tr", "Row local name should be tr")
|
||||
assert_equals(row.tagName, "TR", "Row tag name should be TR")
|
||||
|
||||
var body = row.parentNode
|
||||
assert_equals(body.namespaceURI, HTMLNS, "Body should be in the HTML namespace")
|
||||
assert_equals(body.prefix, null, "Body prefix should be null")
|
||||
assert_equals(body.localName, "tbody", "Body local name should be tr")
|
||||
assert_equals(body.tagName, "TBODY", "Body tag name should be TR")
|
||||
|
||||
assert_array_equals(parentEl.childNodes, [body])
|
||||
assert_array_equals(body.childNodes, [row])
|
||||
assert_array_equals(parentEl.rows, [row])
|
||||
}, "insertRow should not copy prefixes")
|
||||
test(function() {
|
||||
var table = document.createElement("table")
|
||||
var head = table.appendChild(document.createElement("thead"))
|
||||
assert_array_equals(table.rows, [])
|
||||
|
||||
var row = table.insertRow(-1)
|
||||
var body = row.parentNode
|
||||
assert_array_equals(table.childNodes, [head, body])
|
||||
assert_array_equals(head.childNodes, [])
|
||||
assert_array_equals(body.childNodes, [row])
|
||||
assert_array_equals(table.rows, [row])
|
||||
}, "insertRow should insert into a tbody, not into a thead, if table.rows is empty")
|
||||
test(function() {
|
||||
var table = document.createElement("table")
|
||||
var foot = table.appendChild(document.createElement("tfoot"))
|
||||
assert_array_equals(table.rows, [])
|
||||
|
||||
var row = table.insertRow(-1)
|
||||
var body = row.parentNode
|
||||
assert_array_equals(table.childNodes, [foot, body])
|
||||
assert_array_equals(foot.childNodes, [])
|
||||
assert_array_equals(body.childNodes, [row])
|
||||
assert_array_equals(table.rows, [row])
|
||||
}, "insertRow should insert into a tbody, not into a tfoot, if table.rows is empty")
|
||||
</script>
|
||||
|
|
@ -0,0 +1,234 @@
|
|||
<!DOCTYPE html>
|
||||
<title>HTMLTableElement.rows</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
function assert_nodelist_equals(actual, expected) {
|
||||
assert_equals(actual.length, expected.length);
|
||||
|
||||
for (var i = 0; i < actual.length; ++i) {
|
||||
assert_true(i in actual);
|
||||
assert_true(actual.hasOwnProperty(i),
|
||||
"property " + i + " expected to be present on the object");
|
||||
assert_equals(actual.item(i), expected[i]);
|
||||
assert_equals(actual[i], expected[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function test_table_simple(group, table) {
|
||||
var foo1 = group.appendChild(document.createElement("tr"));
|
||||
foo1.id = "foo";
|
||||
var bar1 = group.appendChild(document.createElement("tr"));
|
||||
bar1.id = "bar";
|
||||
var foo2 = group.appendChild(document.createElement("tr"));
|
||||
foo2.id = "foo";
|
||||
var bar2 = group.appendChild(document.createElement("tr"));
|
||||
bar2.id = "bar";
|
||||
|
||||
assert_true(table.rows instanceof HTMLCollection, "table.rows should be a HTMLCollection.");
|
||||
assert_nodelist_equals(table.rows, [foo1, bar1, foo2, bar2]);
|
||||
assert_equals(table.rows.foo, foo1);
|
||||
assert_equals(table.rows["foo"], foo1);
|
||||
assert_equals(table.rows.namedItem("foo"), foo1);
|
||||
assert_equals(table.rows.bar, bar1);
|
||||
assert_equals(table.rows["bar"], bar1);
|
||||
assert_equals(table.rows.namedItem("bar"), bar1);
|
||||
assert_array_equals(Object.getOwnPropertyNames(table.rows), [
|
||||
"0",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"foo",
|
||||
"bar"
|
||||
]);
|
||||
}
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
test_table_simple(table, table);
|
||||
}, "Children of table");
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var group = table.appendChild(document.createElement("thead"));
|
||||
test_table_simple(group, table);
|
||||
}, "Children of thead");
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var group = table.appendChild(document.createElement("tbody"));
|
||||
test_table_simple(group, table);
|
||||
}, "Children of tbody");
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var group = table.appendChild(document.createElement("tfoot"));
|
||||
test_table_simple(group, table);
|
||||
}, "Children of tfoot");
|
||||
test(function() {
|
||||
var table = document.createElement("table");
|
||||
var orphan1 = table.appendChild(document.createElement("tr"));
|
||||
orphan1.id = "orphan1";
|
||||
var foot1 = table.appendChild(document.createElement("tfoot"));
|
||||
var orphan2 = table.appendChild(document.createElement("tr"));
|
||||
orphan2.id = "orphan2";
|
||||
var foot2 = table.appendChild(document.createElement("tfoot"));
|
||||
var orphan3 = table.appendChild(document.createElement("tr"));
|
||||
orphan3.id = "orphan3";
|
||||
var body1 = table.appendChild(document.createElement("tbody"));
|
||||
var orphan4 = table.appendChild(document.createElement("tr"));
|
||||
orphan4.id = "orphan4";
|
||||
var body2 = table.appendChild(document.createElement("tbody"));
|
||||
var orphan5 = table.appendChild(document.createElement("tr"));
|
||||
orphan5.id = "orphan5";
|
||||
var head1 = table.appendChild(document.createElement("thead"));
|
||||
var orphan6 = table.appendChild(document.createElement("tr"));
|
||||
orphan6.id = "orphan6";
|
||||
var head2 = table.appendChild(document.createElement("thead"));
|
||||
var orphan7 = table.appendChild(document.createElement("tr"));
|
||||
orphan7.id = "orphan7";
|
||||
|
||||
var foot1row1 = foot1.appendChild(document.createElement("tr"));
|
||||
foot1row1.id = "foot1row1";
|
||||
var foot1row2 = foot1.appendChild(document.createElement("tr"));
|
||||
foot1row2.id = "foot1row2";
|
||||
var foot2row1 = foot2.appendChild(document.createElement("tr"));
|
||||
foot2row1.id = "foot2row1";
|
||||
var foot2row2 = foot2.appendChild(document.createElement("tr"));
|
||||
foot2row2.id = "foot2row2";
|
||||
|
||||
var body1row1 = body1.appendChild(document.createElement("tr"));
|
||||
body1row1.id = "body1row1";
|
||||
var body1row2 = body1.appendChild(document.createElement("tr"));
|
||||
body1row2.id = "body1row2";
|
||||
var body2row1 = body2.appendChild(document.createElement("tr"));
|
||||
body2row1.id = "body2row1";
|
||||
var body2row2 = body2.appendChild(document.createElement("tr"));
|
||||
body2row2.id = "body2row2";
|
||||
|
||||
var head1row1 = head1.appendChild(document.createElement("tr"));
|
||||
head1row1.id = "head1row1";
|
||||
var head1row2 = head1.appendChild(document.createElement("tr"));
|
||||
head1row2.id = "head1row2";
|
||||
var head2row1 = head2.appendChild(document.createElement("tr"));
|
||||
head2row1.id = "head2row1";
|
||||
var head2row2 = head2.appendChild(document.createElement("tr"));
|
||||
head2row2.id = "head2row2";
|
||||
|
||||
// These elements should not end up in any collection.
|
||||
table.appendChild(document.createElement("div"))
|
||||
.appendChild(document.createElement("tr"));
|
||||
foot1.appendChild(document.createElement("div"))
|
||||
.appendChild(document.createElement("tr"));
|
||||
body1.appendChild(document.createElement("div"))
|
||||
.appendChild(document.createElement("tr"));
|
||||
head1.appendChild(document.createElement("div"))
|
||||
.appendChild(document.createElement("tr"));
|
||||
table.appendChild(document.createElementNS("http://example.com/test", "tr"));
|
||||
foot1.appendChild(document.createElementNS("http://example.com/test", "tr"));
|
||||
body1.appendChild(document.createElementNS("http://example.com/test", "tr"));
|
||||
head1.appendChild(document.createElementNS("http://example.com/test", "tr"));
|
||||
|
||||
assert_true(table.rows instanceof HTMLCollection, "table.rows should be a HTMLCollection.");
|
||||
assert_nodelist_equals(table.rows, [
|
||||
// thead
|
||||
head1row1,
|
||||
head1row2,
|
||||
head2row1,
|
||||
head2row2,
|
||||
|
||||
// tbody + table
|
||||
orphan1,
|
||||
orphan2,
|
||||
orphan3,
|
||||
body1row1,
|
||||
body1row2,
|
||||
orphan4,
|
||||
body2row1,
|
||||
body2row2,
|
||||
orphan5,
|
||||
orphan6,
|
||||
orphan7,
|
||||
|
||||
// tfoot
|
||||
foot1row1,
|
||||
foot1row2,
|
||||
foot2row1,
|
||||
foot2row2
|
||||
]);
|
||||
assert_array_equals(Object.getOwnPropertyNames(table.rows), [
|
||||
"0",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8",
|
||||
"9",
|
||||
"10",
|
||||
"11",
|
||||
"12",
|
||||
"13",
|
||||
"14",
|
||||
"15",
|
||||
"16",
|
||||
"17",
|
||||
"18",
|
||||
"head1row1",
|
||||
"head1row2",
|
||||
"head2row1",
|
||||
"head2row2",
|
||||
"orphan1",
|
||||
"orphan2",
|
||||
"orphan3",
|
||||
"body1row1",
|
||||
"body1row2",
|
||||
"orphan4",
|
||||
"body2row1",
|
||||
"body2row2",
|
||||
"orphan5",
|
||||
"orphan6",
|
||||
"orphan7",
|
||||
"foot1row1",
|
||||
"foot1row2",
|
||||
"foot2row1",
|
||||
"foot2row2"
|
||||
]);
|
||||
|
||||
var ids = [
|
||||
"orphan1",
|
||||
"orphan2",
|
||||
"orphan3",
|
||||
"orphan4",
|
||||
"orphan5",
|
||||
"orphan6",
|
||||
"orphan7",
|
||||
"foot1row1",
|
||||
"foot1row2",
|
||||
"foot2row1",
|
||||
"foot2row2",
|
||||
"body1row1",
|
||||
"body1row2",
|
||||
"body2row1",
|
||||
"body2row2",
|
||||
"head1row1",
|
||||
"head1row2",
|
||||
"head2row1",
|
||||
"head2row2"
|
||||
];
|
||||
ids.forEach(function(id) {
|
||||
assert_equals(table.rows.namedItem(id).id, id);
|
||||
assert_true(id in table.rows);
|
||||
assert_equals(table.rows[id].id, id);
|
||||
assert_true(id in table.rows);
|
||||
});
|
||||
while (table.firstChild) {
|
||||
table.removeChild(table.firstChild);
|
||||
}
|
||||
ids.forEach(function(id) {
|
||||
assert_equals(table.rows.namedItem(id), null);
|
||||
assert_false(id in table.rows);
|
||||
assert_equals(table.rows[id], undefined);
|
||||
assert_false(id in table.rows);
|
||||
});
|
||||
}, "Complicated case");
|
||||
</script>
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTMLTableSectionElement#deleteRow</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<div id ="log"></div>
|
||||
|
||||
<table>
|
||||
<tbody id="testBody">
|
||||
<tr><td>ABCDEF</td></tr>
|
||||
<tr><td>12345</td></tr>
|
||||
<tr><td>ABC12345DEF</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
|
||||
var tbody = document.getElementById("testBody");
|
||||
|
||||
test(function () {
|
||||
tbody.deleteRow(0);
|
||||
assert_equals(tbody.rows.length, 2);
|
||||
assert_equals(tbody.rows[0].childNodes[0].innerHTML, "12345");
|
||||
}, "HTMLTableSectionElement deleteRow(0)");
|
||||
|
||||
test(function () {
|
||||
tbody.deleteRow(-1);
|
||||
assert_equals(tbody.rows.length, 1);
|
||||
assert_equals(tbody.rows[0].childNodes[0].innerHTML, "12345");
|
||||
}, "HTMLTableSectionElement deleteRow(-1)");
|
||||
|
||||
test(function () {
|
||||
assert_throws("IndexSizeError", function () {
|
||||
tbody.deleteRow(tbody.rows.length);
|
||||
});
|
||||
}, "HTMLTableSectionElement deleteRow(rows.length)");
|
||||
|
||||
test(function () {
|
||||
assert_throws("IndexSizeError", function () {
|
||||
tbody.deleteRow(-2);
|
||||
});
|
||||
}, "HTMLTableSectionElement deleteRow(-2)");
|
||||
|
||||
test(function () {
|
||||
assert_equals(tbody.rows.length, 1);
|
||||
tbody.deleteRow(-1);
|
||||
assert_equals(tbody.rows.length, 0);
|
||||
tbody.deleteRow(-1);
|
||||
assert_equals(tbody.rows.length, 0);
|
||||
}, "HTMLTableSectionElement deleteRow(-1) with no rows");
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTMLTableSectionElement#insertRow</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<div id ="log"></div>
|
||||
|
||||
<table>
|
||||
<tbody id="testBody">
|
||||
<tr><td>ABCDEF</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
|
||||
var tbody = document.getElementById("testBody");
|
||||
|
||||
test(function () {
|
||||
var trEle = tbody.insertRow(0);
|
||||
assert_equals(tbody.rows[0], trEle);
|
||||
assert_equals(tbody.rows.length, 2);
|
||||
}, "HTMLTableSectionElement insertRow(0)");
|
||||
|
||||
test(function () {
|
||||
var trEle = tbody.insertRow(-1);
|
||||
assert_equals(tbody.rows[tbody.rows.length - 1], trEle);
|
||||
assert_equals(tbody.rows.length, 3);
|
||||
}, "HTMLTableSectionElement insertRow(-1)");
|
||||
|
||||
test(function () {
|
||||
var trEle = tbody.insertRow();
|
||||
assert_equals(tbody.rows[tbody.rows.length - 1], trEle);
|
||||
assert_equals(tbody.rows.length, 4);
|
||||
}, "HTMLTableSectionElement insertRow()");
|
||||
|
||||
test(function () {
|
||||
var trEle = tbody.insertRow(tbody.rows.length);
|
||||
assert_equals(tbody.rows[tbody.rows.length - 1], trEle);
|
||||
assert_equals(tbody.rows.length, 5);
|
||||
}, "HTMLTableSectionElement insertRow(rows.length)");
|
||||
|
||||
test(function () {
|
||||
assert_throws("IndexSizeError", function () {
|
||||
tbody.insertRow(-2);
|
||||
});
|
||||
}, "HTMLTableSectionElement insertRow(-2)");
|
||||
|
||||
test(function () {
|
||||
assert_throws("IndexSizeError", function () {
|
||||
tbody.insertRow(tbody.rows.length + 1);
|
||||
});
|
||||
}, "HTMLTableSectionElement insertRow(rows.length + 1)");
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>'tbody' element, 'rows' attribute</title>
|
||||
<link rel="author" title="Corey Farwell" href="mailto:coreyf@rwell.org">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/html/semantics/tabular-data/html-table-section-element.js"></script>
|
||||
|
||||
<div id ="log"></div>
|
||||
|
||||
<script>
|
||||
test(function () {
|
||||
testRowsAttribute('tbody');
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>'tfoot' element, 'rows' attribute</title>
|
||||
<link rel="author" title="Corey Farwell" href="mailto:coreyf@rwell.org">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/html/semantics/tabular-data/html-table-section-element.js"></script>
|
||||
|
||||
<div id ="log"></div>
|
||||
|
||||
<script>
|
||||
test(function () {
|
||||
testRowsAttribute('tfoot');
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>'thead' element, 'rows' attribute</title>
|
||||
<link rel="author" title="Corey Farwell" href="mailto:coreyf@rwell.org">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/html/semantics/tabular-data/html-table-section-element.js"></script>
|
||||
|
||||
<div id ="log"></div>
|
||||
|
||||
<script>
|
||||
test(function () {
|
||||
testRowsAttribute('thead');
|
||||
});
|
||||
</script>
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTMLTableRowElement#cells</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<div id="log"></div>
|
||||
|
||||
<table>
|
||||
<tr id="testTr">
|
||||
<td>First</td>
|
||||
<div><td>Second</td></div>
|
||||
<td>Third
|
||||
<table>
|
||||
<tr><td>Nested first</td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<img>
|
||||
</tr>
|
||||
</table>
|
||||
<script>
|
||||
var tr = document.getElementById("testTr");
|
||||
|
||||
test(function () {
|
||||
tr.insertBefore(document.createElementNS("foo", "td"), tr.children[1]);
|
||||
assert_array_equals(tr.cells, [tr.children[0], tr.children[2], tr.children[3]]);
|
||||
}, "HTMLTableRowElement cells ignores nested tables and non-HTML elements");
|
||||
</script>
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTMLTableRowElement#deleteCell</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<div id="log"></div>
|
||||
|
||||
<table>
|
||||
<tr id="testTr">
|
||||
<td>ABCDE</td>
|
||||
<td>12345</td>
|
||||
<td>ABC12</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
|
||||
var tr = document.getElementById("testTr");
|
||||
|
||||
test(function () {
|
||||
tr.deleteCell(0);
|
||||
assert_equals(tr.cells[0].innerHTML, "12345");
|
||||
assert_equals(tr.cells.length, 2);
|
||||
}, "HTMLTableRowElement deleteCell(0)");
|
||||
|
||||
test(function () {
|
||||
tr.deleteCell(-1);
|
||||
assert_equals(tr.cells[tr.cells.length - 1].innerHTML, "12345");
|
||||
assert_equals(tr.cells.length, 1);
|
||||
}, "HTMLTableRowElement deleteCell(-1)");
|
||||
|
||||
test(function () {
|
||||
assert_throws("IndexSizeError", function () {
|
||||
tr.deleteCell(-2);
|
||||
});
|
||||
}, "HTMLTableRowElement deleteCell(-2)");
|
||||
|
||||
test(function () {
|
||||
assert_throws("IndexSizeError", function () {
|
||||
tr.deleteCell(tr.cells.length);
|
||||
});
|
||||
}, "HTMLTableRowElement deleteCell(cells.length)");
|
||||
|
||||
test(function () {
|
||||
assert_equals(tr.cells.length, 1);
|
||||
tr.deleteCell(-1);
|
||||
assert_equals(tr.cells.length, 0);
|
||||
tr.deleteCell(-1);
|
||||
assert_equals(tr.cells.length, 0);
|
||||
}, "HTMLTableRowElement deleteCell(-1) with no cells");
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>HTMLTableRowElement#insertCell</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com/">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<div id="log"></div>
|
||||
|
||||
<table>
|
||||
<tr id="testTr"></tr>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
|
||||
var tr = document.getElementById("testTr");
|
||||
|
||||
test(function () {
|
||||
var tdEle = tr.insertCell(0);
|
||||
assert_equals(tr.cells[0], tdEle);
|
||||
assert_equals(tr.cells.length, 1);
|
||||
}, "HTMLTableRowElement insertCell(0)");
|
||||
|
||||
test(function () {
|
||||
var tdEle = tr.insertCell(-1);
|
||||
assert_equals(tr.cells[tr.cells.length - 1], tdEle);
|
||||
assert_equals(tr.cells.length, 2);
|
||||
}, "HTMLTableRowElement insertCell(-1)");
|
||||
|
||||
|
||||
test(function () {
|
||||
var tdEle = tr.insertCell(tr.cells.length);
|
||||
assert_equals(tr.cells[tr.cells.length - 1], tdEle);
|
||||
assert_equals(tr.cells.length, 3);
|
||||
}, "HTMLTableRowElement insertCell(cells.length)");
|
||||
|
||||
test(function () {
|
||||
var tdEle = tr.insertCell();
|
||||
assert_equals(tr.cells[tr.cells.length - 1], tdEle);
|
||||
assert_equals(tr.cells.length, 4);
|
||||
}, "HTMLTableRowElement insertCell()");
|
||||
|
||||
test(function () {
|
||||
assert_throws("IndexSizeError", function () {
|
||||
tr.insertCell(-2);
|
||||
});
|
||||
}, "HTMLTableRowElement insertCell(-2)");
|
||||
|
||||
test(function () {
|
||||
assert_throws("IndexSizeError", function () {
|
||||
tr.insertCell(tr.cells.length + 1);
|
||||
});
|
||||
}, "HTMLTableRowElement insertCell(cells.length + 1)");
|
||||
|
||||
</script>
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
<!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>
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>HTMLTableRowElement.sectionRowIndex</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr id="ht1"></tr>
|
||||
</thead>
|
||||
<tr id="t1"></tr>
|
||||
<tr id="t2">
|
||||
<td>
|
||||
<table>
|
||||
<thead>
|
||||
<tr id="nht1"></tr>
|
||||
</thead>
|
||||
<tr></tr>
|
||||
<tr id="nt1"></tr>
|
||||
<tbody>
|
||||
<tr id="nbt1"></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tbody>
|
||||
<tr></tr>
|
||||
<tr id="bt1"></tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr></tr>
|
||||
<tr></tr>
|
||||
<tr id="ft1"></tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<script>
|
||||
test(function() {
|
||||
var tHeadRow = document.getElementById('ht1');
|
||||
assert_equals(tHeadRow.sectionRowIndex, 0);
|
||||
}, "Row in thead in HTML");
|
||||
|
||||
test(function() {
|
||||
var tRow1 = document.getElementById('t1');
|
||||
assert_equals(tRow1.sectionRowIndex, 0);
|
||||
}, "Row in implicit tbody in HTML");
|
||||
|
||||
test(function() {
|
||||
var tRow2 = document.getElementById('t2');
|
||||
assert_equals(tRow2.sectionRowIndex, 1);
|
||||
}, "Other row in implicit tbody in HTML");
|
||||
|
||||
test(function() {
|
||||
var tBodyRow = document.getElementById('bt1');
|
||||
assert_equals(tBodyRow.sectionRowIndex, 1);
|
||||
}, "Row in explicit tbody in HTML");
|
||||
|
||||
test(function() {
|
||||
var tFootRow = document.getElementById('ft1');
|
||||
assert_equals(tFootRow.sectionRowIndex, 2);
|
||||
}, "Row in tfoot in HTML");
|
||||
|
||||
test(function() {
|
||||
var childHeadRow = document.getElementById('nht1');
|
||||
assert_equals(childHeadRow.sectionRowIndex, 0);
|
||||
}, "Row in thead in nested table in HTML");
|
||||
|
||||
test(function() {
|
||||
var childRow = document.getElementById('nt1');
|
||||
assert_equals(childRow.sectionRowIndex, 1);
|
||||
}, "Row in implicit tbody in nested table in HTML");
|
||||
|
||||
test(function() {
|
||||
var childBodyRow = document.getElementById('nbt1');
|
||||
assert_equals(childBodyRow.sectionRowIndex, 0);
|
||||
}, "Row in explicit tbody in nested table in HTML");
|
||||
|
||||
/* script create element test */
|
||||
var mkTrElm = function (elst) {
|
||||
var elm = document.createElement("table");
|
||||
elst.forEach(function(item) {
|
||||
elm = elm.appendChild(document.createElement(item));
|
||||
});
|
||||
return elm.appendChild(document.createElement("tr"));
|
||||
};
|
||||
|
||||
test(function() {
|
||||
assert_equals(mkTrElm([]).sectionRowIndex, 0);
|
||||
}, "Row in script-created table");
|
||||
|
||||
test(function() {
|
||||
assert_equals(mkTrElm(["div"]).sectionRowIndex, -1);
|
||||
}, "Row in script-created div in table");
|
||||
|
||||
test(function() {
|
||||
assert_equals(mkTrElm(["thead"]).sectionRowIndex, 0);
|
||||
}, "Row in script-created thead in table");
|
||||
|
||||
test(function() {
|
||||
assert_equals(mkTrElm(["tbody"]).sectionRowIndex, 0);
|
||||
}, "Row in script-created tbody in table");
|
||||
|
||||
test(function() {
|
||||
assert_equals(mkTrElm(["tfoot"]).sectionRowIndex, 0);
|
||||
}, "Row in script-created tfoot in table");
|
||||
|
||||
test(function() {
|
||||
assert_equals(mkTrElm(["tbody", "tr"]).sectionRowIndex, -1);
|
||||
}, "Row in script-created tr in tbody in table");
|
||||
|
||||
test(function() {
|
||||
assert_equals(mkTrElm(["tbody", "tr", "td"]).sectionRowIndex, -1);
|
||||
}, "Row in script-created td in tr in tbody in table");
|
||||
|
||||
test(function() {
|
||||
assert_equals(mkTrElm(["tbody", "tr", "td", "table"]).sectionRowIndex, 0);
|
||||
}, "Row in script-created nested table");
|
||||
|
||||
test(function() {
|
||||
assert_equals(mkTrElm(["tbody", "tr", "td", "table", "thead"]).sectionRowIndex, 0);
|
||||
}, "Row in script-created thead in nested table");
|
||||
|
||||
test(function() {
|
||||
assert_equals(mkTrElm(["tbody", "tr", "td", "table", "tbody"]).sectionRowIndex, 0);
|
||||
}, "Row in script-created tbody in nested table");
|
||||
|
||||
test(function() {
|
||||
assert_equals(mkTrElm(["tbody", "tr", "td", "table", "tfoot"]).sectionRowIndex, 0);
|
||||
}, "Row in script-created tfoot in nested table");
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue