tor-browser

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

template-content.html (2140B)


      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 element, 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/#template-element">
      9 <script src="/resources/testharness.js"></script>
     10 <script src="/resources/testharnessreport.js"></script>
     11 <script src='/html/resources/common.js'></script>
     12 </head>
     13 <body>
     14 <div id="log"></div>
     15 <script type="text/javascript">
     16 
     17 HTML5_ELEMENTS.forEach(function(value) {
     18    if (value !== 'body' && value !== 'html' && value !== 'head' && value !== 'frameset') {
     19 
     20        test(function() {
     21            var doc = newHTMLDocument();
     22            var template = doc.createElement('template');
     23            var element = doc.createElement(value);
     24            template.content.appendChild(element);
     25            var valueToTest = template.content.querySelector(value);
     26 
     27            doc.body.appendChild(template);
     28 
     29            assert_not_equals(valueToTest, null);
     30        }, 'Template may contain ' + value + ' element');
     31 
     32    }
     33 });
     34 
     35 
     36 
     37 var parameters = [];
     38 
     39 HTML5_ELEMENTS.forEach(function(value) {
     40    if (value !== 'body' && value !== 'html' && value !== 'head' && value !== 'frameset') {
     41 
     42        test(function() {
     43            var doc = newHTMLDocument();
     44 
     45            if (isVoidElement(value)) {
     46                doc.body.innerHTML = '<template><' + value + '/></template>';
     47            } else {
     48                doc.body.innerHTML = '<template><' + value + '></' + value + '></template>';
     49            }
     50 
     51            var template = doc.querySelector('template');
     52            var element = template.content.querySelector(value);
     53 
     54            assert_not_equals(element, null);
     55        }, 'Template may contain ' + value + ' element. '
     56             + 'The template element and contents are added via body.innerHTML');
     57 
     58    }
     59 });
     60 
     61 </script>
     62 </body>
     63 </html>