tor-browser

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

test-007.html (2092B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <title>Shadow DOM Test: A_04_01_07</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 addressable from any attributes of elements in the same shadow DOM subtree">
      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 for label.control
     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    var input = d.createElement('input');
     23    input.setAttribute('type', 'text');
     24    input.setAttribute('id', 'input_id');
     25    d.body.appendChild(input);
     26 
     27    var label = d.createElement('label');
     28    label.setAttribute('for', 'input_id');
     29    s.appendChild(label);
     30    s.appendChild(input);
     31 
     32    assert_equals(label.control, input, 'Elements in shadow DOM must be accessible from ' +
     33        'shadow document label.for attribute');
     34 
     35 }, 'A_04_01_07_T01');
     36 
     37 // check for elem.form associated elements
     38 test(function () {
     39 
     40    HTML5_FORM_ASSOCIATED_ELEMENTS.forEach(function (tagName) {
     41        d = newHTMLDocument();
     42 
     43        var form = d.createElement('form');
     44        var el = d.createElement(tagName);
     45 
     46        d.body.appendChild(form);
     47        d.body.appendChild(el);
     48 
     49        form.setAttribute('id', 'form_id');
     50        el.setAttribute('form', 'form_id');
     51 
     52        div = d.createElement('div');
     53        d.body.appendChild(div);
     54 
     55        var s = div.attachShadow({mode: 'open'});
     56        s.appendChild(form);
     57        s.appendChild(el);
     58 
     59        assert_equals(el.form, form, 'Elements in shadow DOM must be accessible from ' +
     60            'shadow document ' + tagName + '.form attribute');
     61    });
     62 }, 'A_04_01_07_T02');
     63 </script>
     64 </body>
     65 </html>