OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <title>HTML Templates: Node document of the template content attribute must be t
emplate contents owner</title> | |
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="Node document of the template content attribute mus
t be template contents owner"> | |
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 test(function() { | |
19 var doc = newHTMLDocument(); | |
20 var template = doc.createElement('template'); | |
21 var nestedTemplate = doc.createElement('template'); | |
22 template.appendChild(nestedTemplate); | |
23 | |
24 assert_equals(nestedTemplate.content.ownerDocument, template.content.ownerDo
cument, | |
25 'Wrong node document of the template content attribute'); | |
26 | |
27 }, 'Node document of the template content attribute must be template contents ow
ner. ' + | |
28 'Nested template element created by createElement'); | |
29 | |
30 | |
31 test(function() { | |
32 var doc = newHTMLDocument(); | |
33 doc.body.innerHTML = '<template><template></template></template>'; | |
34 var template = doc.querySelector('template'); | |
35 var nestedTemplate = template.content.querySelector('template'); | |
36 | |
37 assert_equals(nestedTemplate.content.ownerDocument, template.content.ownerDo
cument, | |
38 'Wrong node document of the template content attribute'); | |
39 | |
40 }, 'Node document of the template content attribute must be template contents ow
ner. ' + | |
41 'Nested template element created by innerHTML'); | |
42 | |
43 testInIFrame('../resources/two-templates.html', function(context) { | |
44 var doc = context.iframes[0].contentDocument; | |
45 | |
46 var template1 = doc.querySelector('#template1'); | |
47 var template2 = doc.querySelector('#template2'); | |
48 | |
49 // when there is a browsing context, template contents owner is only accessi
ble via template.content.ownerDocument | |
50 // because template contents owner is bounded to document | |
51 // verify that multiple templates share the same instance of template conten
ts owner | |
52 | |
53 assert_equals(template1.content.ownerDocument, template2.content.ownerDocume
nt, | |
54 'Wrong node document of the template content attribute'); | |
55 }, 'Node document of the template content attribute must be template contents ow
ner. ' + | |
56 'Load HTML file with multiple template elements'); | |
57 | |
58 </script> | |
59 </body> | |
60 </html> | |
OLD | NEW |