| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <title>HTML Templates: Template element as a descendant of the body element.</ti
tle> | |
| 5 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> | |
| 6 <meta name="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru
"> | |
| 7 <meta name="assert" content="Template element can be a descendant of the body el
ement"> | |
| 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 function templateIsAChild(element) { | |
| 19 element.innerHTML = '<template>some text</template>'; | |
| 20 | |
| 21 assert_not_equals(element.querySelector('template'), null, | |
| 22 'Template element should be a descendant of the ' + element.tagName + '
element'); | |
| 23 } | |
| 24 | |
| 25 function templateIsAnIndirectChild(element) { | |
| 26 element.innerHTML = '<div><template>some text</template></div>'; | |
| 27 | |
| 28 assert_not_equals(element.querySelector('template'), null, | |
| 29 'Template element should be a descendant of the ' + element.tagName + '
element'); | |
| 30 } | |
| 31 | |
| 32 function templateIsAnAppendedChild(doc, element) { | |
| 33 var template = doc.createElement('template'); | |
| 34 | |
| 35 element.appendChild(template); | |
| 36 | |
| 37 assert_not_equals(element.querySelector('template'), null, | |
| 38 'Template element should be a descendant of the ' + element.tagName + '
element'); | |
| 39 } | |
| 40 | |
| 41 function templateIsAnAppendedIndirectChild(doc, element) { | |
| 42 var template = doc.createElement('template'); | |
| 43 var div = doc.createElement('div'); | |
| 44 div.appendChild(template); | |
| 45 | |
| 46 element.appendChild(div); | |
| 47 | |
| 48 assert_not_equals(element.querySelector('template'), null, | |
| 49 'Template element should be a descendant of the ' + element.tagName + '
element'); | |
| 50 } | |
| 51 | |
| 52 var doc = newHTMLDocument(); | |
| 53 var frameset = doc.createElement('frameset'); | |
| 54 | |
| 55 var parameters = [['Template element as a descendant of the BODY element. ' + | |
| 56 'Template element is created by innerHTML', | |
| 57 doc.body], | |
| 58 ['Template element as a descendant of the HEAD element. ' + | |
| 59 'Template element is created by innerHTML', | |
| 60 doc.head], | |
| 61 ['Template element as a descendant of the FRAMESET element. '
+ | |
| 62 'Template element is created by innerHTML', | |
| 63 frameset] | |
| 64 ]; | |
| 65 generate_tests(templateIsAChild, parameters, | |
| 66 'Template element as a descendant of the HEAD, BODY and FRAMESET element
s'); | |
| 67 | |
| 68 | |
| 69 | |
| 70 parameters = [['Template element as an indirect descendant of the BODY element.
' + | |
| 71 'Template element is created by innerHTML', | |
| 72 doc.body], | |
| 73 ['Template element as an indirect descendant of the HEAD element.
' + | |
| 74 'Template element is created by innerHTML', | |
| 75 doc.head], | |
| 76 ['Template element as an indirect descendant of the FRAMESET elem
ent. ' + | |
| 77 'Template element is created by innerHTML', | |
| 78 frameset] | |
| 79 ]; | |
| 80 generate_tests(templateIsAnIndirectChild, parameters, | |
| 81 'Template element as an indirect descendant of the HEAD, BODY and FRAMES
ET elements'); | |
| 82 | |
| 83 | |
| 84 | |
| 85 parameters = [['Template element as a descendant of the BODY element. ' + | |
| 86 'Template element is appended by appendChild()', | |
| 87 doc, doc.body], | |
| 88 ['Template element as a descendant of the HEAD element. ' + | |
| 89 'Template element is appended by appendChild()', | |
| 90 doc, doc.head], | |
| 91 ['Template element as a descendant of the FRAMESET element. ' + | |
| 92 'Template element is appended by appendChild()', | |
| 93 doc, frameset] | |
| 94 ]; | |
| 95 generate_tests(templateIsAnAppendedChild, parameters, | |
| 96 'Template element as a descendant of the HEAD, BODY and FRAMESET element
s'); | |
| 97 | |
| 98 | |
| 99 | |
| 100 parameters = [['Template element as an indirect descendant of the BODY element.
' + | |
| 101 'Template element is appended by appendChild()', | |
| 102 doc, doc.body], | |
| 103 ['Template element as an indirect descendant of the HEAD element.
' + | |
| 104 'Template element is appended by appendChild()', | |
| 105 doc, doc.head], | |
| 106 ['Template element as an indirect descendant of the FRAMESET elem
ent. ' + | |
| 107 'Template element is appended by appendChild()', | |
| 108 doc, frameset] | |
| 109 ]; | |
| 110 generate_tests(templateIsAnAppendedIndirectChild, parameters, | |
| 111 'Template element as a descendant of the HEAD, BODY and FRAMESET element
s'); | |
| 112 | |
| 113 </script> | |
| 114 </body> | |
| 115 </html> | |
| OLD | NEW |