mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implement createCaption and deleteCaption on HTMLTableElement
Update web-platform-tests expected data
This commit is contained in:
parent
78792cced2
commit
e24a867ab6
8 changed files with 59 additions and 51 deletions
|
@ -11,6 +11,8 @@
|
|||
</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>
|
||||
|
@ -19,6 +21,7 @@
|
|||
</tr>
|
||||
</table>
|
||||
<table id="table2" style="display:none">
|
||||
<foo:caption>caption</foo:caption>
|
||||
<tr>
|
||||
<td>cell</td>
|
||||
<td>cell</td>
|
||||
|
@ -31,7 +34,18 @@
|
|||
<td>cell</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table id="table4" 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();
|
||||
|
@ -45,12 +59,28 @@
|
|||
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")
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue