tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

template-contents-owner-test-001.html (1482B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <title>HTML Templates: The template contents owner document (no browsing context)</title>
      5 <meta name="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
      6 <meta name="assert" content="Even if template's enclosing document has no browsing context, it gets its own template contents owner">
      7 <link rel="help" href="http://www.w3.org/TR/2013/WD-html-templates-20130214/#definitions">
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 <script src='/html/resources/common.js'></script>
     11 </head>
     12 <body>
     13 <div id="log"></div>
     14 <script type="text/javascript">
     15 
     16 
     17 test(function() {
     18    var doc = newHTMLDocument();
     19    var template = doc.createElement('template');
     20 
     21    doc.body.appendChild(template);
     22 
     23    assert_not_equals(template.content.ownerDocument, doc, 'Wrong template content owner');
     24 
     25 }, 'Test the template contents owner document when enclosing document has '
     26    + 'no browsing content. Template element is created by createElement()');
     27 
     28 
     29 
     30 test(function() {
     31    var doc = newHTMLDocument();
     32 
     33    doc.body.innerHTML = '<template><div>some text</div></template>';
     34 
     35    var template = doc.querySelector('template');
     36 
     37    assert_not_equals(template.content.ownerDocument, doc, 'Wrong template content owner');
     38 
     39 }, 'Test the template contents owner document when enclosing document has '
     40    + 'no browsing content. Template element is created by innerHTML');
     41 
     42 </script>
     43 </body>
     44 </html>