tor-browser

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

test-005.html (2170B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <title>Shadow DOM Test: A_04_01_05</title>
      5 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
      6 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#upper-boundary-encapsulation">
      7 <meta name="assert" content="Upper-boundary encapsulation:The nodes with a unique id and named elements are not addressable from any attributes of elements in shadow host's document">
      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>
     15 // check label.for attribute
     16 test(function () {
     17    var d = newHTMLDocument();
     18    var div = d.createElement('div');
     19    d.body.appendChild(div);
     20    var s = div.attachShadow({mode: 'open'});
     21 
     22    // node in shadow with id
     23    var input = d.createElement('input');
     24    input.setAttribute('type', 'text');
     25    input.setAttribute('id', 'input_id');
     26    d.body.appendChild(input);
     27    s.appendChild(input);
     28 
     29    // node in host with a reference to host element with id
     30    var label = d.createElement('label');
     31    label.setAttribute('for', 'input_id');
     32    d.body.appendChild(label);
     33 
     34    assert_equals(label.control, null, 'Elements in shadow DOM must not be accessible from ' +
     35        'owner\'s document label.for attribute');
     36 
     37 }, 'A_04_01_05_T01');
     38 
     39 // check form associated elements
     40 test(function () {
     41 
     42    HTML5_FORM_ASSOCIATED_ELEMENTS.forEach(function (tagName) {
     43        var d = newHTMLDocument();
     44        var div = d.createElement('div');
     45        d.body.appendChild(div);
     46        var s = div.attachShadow({mode: 'open'});
     47 
     48        var form = d.createElement('form');
     49        form.setAttribute('id', 'form_id');
     50        d.body.appendChild(form);
     51 
     52        var el = d.createElement(tagName);
     53        el.setAttribute('form', 'form_id');
     54        d.body.appendChild(el);
     55 
     56        s.appendChild(form);
     57 
     58        assert_equals(el.form, null, 'Elements in shadow DOM must not be accessible from ' +
     59            'owner\'s document ' + tagName + '.form attribute');
     60    });
     61 }, 'A_04_01_05_T02');
     62 </script>
     63 </body>
     64 </html>