summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context.html')
-rw-r--r--testing/web-platform/tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context.html71
1 files changed, 71 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context.html b/testing/web-platform/tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context.html
new file mode 100644
index 000000000..250391612
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing/template/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>HTML Templates: Clearing stack back to a table row context</title>
+<meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
+<meta name="assert" content="Clearing the stack back to a table row context must be aborted if the current node is template">
+<link rel="help" href="http://www.w3.org/TR/2013/WD-html-templates-20130214/#clearing-the-stack">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/html/resources/common.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script type="text/javascript">
+
+function doTest(doc, templateInnerHTML, id, tagName, elementId) {
+
+ doc.body.innerHTML = '' +
+ '<table id="tbl">' +
+ '<tr id="tr">' +
+ '<template id="tmpl1">' +
+ // When parser meets <th>, <td>, </tr>, stack must be cleared
+ // back to table row context.
+ // But <template> tag should abort this
+ templateInnerHTML +
+ '</template>' +
+ '<td id="td">' +
+ '</td>' +
+ '</tr>' +
+ '</table>';
+
+ var table = doc.querySelector('#tbl');
+ var tr = doc.querySelector('#tr');
+ var td = doc.querySelector('#td');
+ var template = doc.querySelector('#tmpl1');
+
+ assert_equals(table.rows.length, 1, 'Wrong number of table rows');
+ assert_equals(table.rows[0].cells.length, 1, 'Wrong number of table cells');
+ assert_equals(template.parentNode, tr, 'Wrong template parent');
+ if (id !== null) {
+ assert_not_equals(template.content.querySelector('#' + id), null,
+ 'Element should present in the template content');
+ }
+ if (tagName !== null) {
+ assert_equals(template.content.querySelector('#' + id).tagName, tagName,
+ 'Wrong element in the template content');
+ }
+ if (elementId) {
+ assert_equals(doc.querySelector('#' + elementId), null,
+ 'Table should have no element with ID ' + elementId);
+ }
+}
+
+
+var doc = newHTMLDocument();
+var parameters = [
+ ['Clearing stack back to a table row context. Test <th>',
+ doc, '<th id="th1">Table header</th>', 'th1', 'TH', 'th1'],
+
+ ['Clearing stack back to a table row context. Test <td>',
+ doc, '<td id="td1">Table cell</td>', 'td1', 'TD', 'td1'],
+
+ ['Clearing stack back to a table row context. Test </tr>',
+ doc, '</tr>', null, null]
+];
+
+generate_tests(doTest, parameters, 'Clearing stack back to a table body context.');
+
+</script>
+</body>
+</html>