| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <title>HTML Templates: The template contents owner document (there's browsing co
ntext)</title> | |
| 5 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> | |
| 6 <meta name="assert" content="If template's enclosing document has browsing conte
xt, then templates content owner must be a new Document node without browsing co
ntext"> | |
| 7 <link rel="help" href="http://www.w3.org/TR/2013/WD-html-templates-20130214/#def
initions"> | |
| 8 <script src="../../../../../../../resources/testharness.js"></script> | |
| 9 <script src="../../../../../../../resources/testharnessreport.js"></script> | |
| 10 <script src='/html/resources/common.js'></script> | |
| 11 <link rel="stylesheet" href="../../../../../../../resources/testharness.css"> | |
| 12 </head> | |
| 13 <body> | |
| 14 <div id="log"></div> | |
| 15 <script type="text/javascript"> | |
| 16 | |
| 17 | |
| 18 testInIFrame(null, function(context) { | |
| 19 var doc = context.iframes[0].contentDocument; | |
| 20 var template = doc.createElement('template'); | |
| 21 | |
| 22 var div = doc.createElement('div'); | |
| 23 div.setAttribute('id', 'div1'); | |
| 24 | |
| 25 template.appendChild(div); | |
| 26 | |
| 27 doc.body.appendChild(template); | |
| 28 | |
| 29 // doc has browsing context. There should be another document as a template | |
| 30 // content owner | |
| 31 assert_not_equals(template.content.ownerDocument, doc, 'Wrong template owner
document'); | |
| 32 | |
| 33 }, 'The template contents owner document must be different from template owner d
ocument,' + | |
| 34 ' which has browsing context. Template element is created by createElement(
)'); | |
| 35 | |
| 36 | |
| 37 | |
| 38 testInIFrame(null, function(context) { | |
| 39 var doc = context.iframes[0].contentDocument; | |
| 40 | |
| 41 doc.body.innerHTML = '<template><div>some text</div></template>'; | |
| 42 | |
| 43 var template = doc.querySelector('template'); | |
| 44 | |
| 45 // doc has browsing context. There should be another document as a template | |
| 46 // content owner | |
| 47 assert_not_equals(template.content.ownerDocument, doc, 'Wrong template owner
document'); | |
| 48 | |
| 49 }, 'The template contents owner document must be different from template owner d
ocument,' + | |
| 50 ' which has browsing context. Template element is created via innerHTML'); | |
| 51 | |
| 52 | |
| 53 | |
| 54 testInIFrame('../resources/template-contents.html', function(context) { | |
| 55 var doc = context.iframes[0].contentDocument; | |
| 56 | |
| 57 var template = doc.querySelector('template'); | |
| 58 | |
| 59 // doc has browsing context. There should be another document as a template | |
| 60 // content owner | |
| 61 assert_not_equals(template.content.ownerDocument, doc, 'Wrong template owner
document'); | |
| 62 | |
| 63 }, 'The template contents owner document must be different from template owner d
ocument,' + | |
| 64 ' which has browsing context. Template element is created by HTML parser'); | |
| 65 | |
| 66 </script> | |
| 67 </body> | |
| 68 </html> | |
| OLD | NEW |