tor-browser

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

ownerdocument-002.html (1832B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <title>Shadow DOM Test: Upper-boundary encapsuration on ownerDocument: with all HTML5 elements</title>
      5 <link rel="author" title="Aleksei Yu. Semenov" href="mailto:sgrekhov@unipro.ru">
      6 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
      7 <link rel="author" title="Mikhail Fursov" href="mailto:mfursov@unipro.ru">
      8 <link rel="author" title="Yuta Kitamura" href="mailto:yutak@google.com">
      9 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#upper-boundary-encapsulation">
     10 <meta name="assert" content="Upper-boundary encapsulation: The ownerDocument property of all nodes in shadow tree refers to the document of the shadow host.">
     11 <script src="/resources/testharness.js"></script>
     12 <script src="/resources/testharnessreport.js"></script>
     13 <script src="../../../../html/resources/common.js"></script>
     14 </head>
     15 <body>
     16 <div id="log"></div>
     17 <script>
     18 function testElement(elementName) {
     19    var doc = document.implementation.createHTMLDocument('Test');
     20    var element = doc.createElement(elementName);
     21    doc.body.appendChild(element);
     22    var shadowRoot = element.attachShadow({mode: 'open'});
     23    HTML5_SHADOW_ALLOWED_ELEMENTS.forEach(function (name) {
     24        shadowRoot.appendChild(doc.createElement(name));
     25    });
     26 
     27    var iterator = doc.createNodeIterator(shadowRoot, 0xFFFFFFFF, null);
     28    var node;
     29    while (node = iterator.nextNode()) {
     30        assert_equals(node.ownerDocument, doc);
     31    }
     32 }
     33 
     34 var testParameters = HTML5_SHADOW_ALLOWED_ELEMENTS.map(function (name) {
     35    return [
     36        'ownerDocument property of any elements in a shadow tree should ' +
     37        'match the document of the shadow host, when the host is a "' +
     38        name + '" element.',
     39        name
     40    ];
     41 });
     42 
     43 generate_tests(testElement, testParameters);
     44 </script>
     45 </body>
     46 </html>