OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <title>HTML Templates: HTML elements in template content</title> | |
5 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> | |
6 <meta name="author" title="Aleksei Yu. Semenov" href="a.semenov@unipro.ru"> | |
7 <meta name="assert" content="Template may contain any element, except the html e
lement, the head element, the body element, or the frameset element"> | |
8 <link rel="help" href="http://www.w3.org/TR/2013/WD-html-templates-20130214/#tem
plate-element"> | |
9 <script src="../../../../../../../resources/testharness.js"></script> | |
10 <script src="../../../../../../../resources/testharnessreport.js"></script> | |
11 <script src='/html/resources/common.js'></script> | |
12 <link rel="stylesheet" href="../../../../../../../resources/testharness.css"> | |
13 </head> | |
14 <body> | |
15 <div id="log"></div> | |
16 <script type="text/javascript"> | |
17 | |
18 var parameters = []; | |
19 | |
20 HTML5_ELEMENTS.forEach(function(value) { | |
21 if (value !== 'body' && value !== 'html' && value !== 'head' && value !== 'f
rameset') { | |
22 | |
23 var doc = newHTMLDocument(); | |
24 var template = doc.createElement('template'); | |
25 var element = doc.createElement(value); | |
26 template.content.appendChild(element); | |
27 var valueToTest = template.content.querySelector(value); | |
28 | |
29 doc.body.appendChild(template); | |
30 | |
31 parameters.push([ | |
32 'Template may contain ' + value + ' element', | |
33 valueToTest, | |
34 null | |
35 ]); | |
36 } | |
37 }); | |
38 | |
39 generate_tests(assert_not_equals, parameters, | |
40 'Template may contain any element, except the html element, ' | |
41 + 'the head element, the body element, or the frameset element'); | |
42 | |
43 | |
44 | |
45 | |
46 var parameters = []; | |
47 | |
48 HTML5_ELEMENTS.forEach(function(value) { | |
49 if (value !== 'body' && value !== 'html' && value !== 'head' && value !== 'fr
ameset') { | |
50 | |
51 var doc = newHTMLDocument(); | |
52 | |
53 if (isVoidElement(value)) { | |
54 doc.body.innerHTML = '<template><' + value + '/></template>'; | |
55 } else { | |
56 doc.body.innerHTML = '<template><' + value + '></' + value + '></templa
te>'; | |
57 } | |
58 | |
59 var template = doc.querySelector('template'); | |
60 var element = template.content.querySelector(value); | |
61 | |
62 parameters.push([ | |
63 'Template may contain ' + value + ' element. ' | |
64 +'The template element and contents are added via body.innerHTML', | |
65 element, | |
66 null | |
67 ]); | |
68 } | |
69 }); | |
70 | |
71 generate_tests(assert_not_equals, parameters, | |
72 'Template may contain any element, except the html element, ' | |
73 + 'the head element, the body element, or the frameset element. ' | |
74 +'The template element and contents are added via body.innerHTML'); | |
75 | |
76 </script> | |
77 </body> | |
78 </html> | |
OLD | NEW |