tor-browser

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

test-001.html (3036B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <title>Shadow DOM Test: A_05_01_01</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/#event-retargeting">
      7 <meta name="assert" content="Event Retargeting:test that event.target is retargeted when event crosses shadow boundary and vice versa">
      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 var A_05_01_01_T1 = async_test('A_05_01_01_T1');
     16 
     17 A_05_01_01_T1.step(function () {
     18    var iframe = document.createElement('iframe');
     19    iframe.src = '../../resources/blank.html';
     20    document.body.appendChild(iframe);
     21 
     22    iframe.onload = A_05_01_01_T1.step_func(function () {
     23 
     24    try {
     25        var d = iframe.contentDocument;
     26        var div = d.createElement('div');
     27        d.body.appendChild(div);
     28 
     29        var s = div.attachShadow({mode: 'open'});
     30 
     31        var div2 = d.createElement('div');
     32        s.appendChild(div2);
     33 
     34        var inp = d.createElement('input');
     35        inp.setAttribute('type', 'text');
     36        inp.setAttribute('id', 'inpid');
     37        div2.appendChild(inp);
     38 
     39        div2.addEventListener('click', A_05_01_01_T1.step_func(function (event) {
     40            assert_equals(event.target.tagName, 'INPUT', 'Information about target of the event that ' +
     41                    'doesn\'t cross the shadow boundaries should not be adjusted');
     42        }), false);
     43 
     44        var event = d.createEvent('HTMLEvents');
     45        event.initEvent ("click", true, false);
     46        inp.dispatchEvent(event);
     47    } finally {
     48        iframe.parentNode.removeChild(iframe);
     49    }
     50    A_05_01_01_T1.done();
     51    });
     52 });
     53 
     54 
     55 
     56 var A_05_01_01_T2 = async_test('A_05_01_01_T2');
     57 
     58 A_05_01_01_T2.step(function () {
     59    var iframe = document.createElement('iframe');
     60    iframe.src = '../../resources/blank.html';
     61    document.body.appendChild(iframe);
     62 
     63    iframe.onload = A_05_01_01_T2.step_func(function () {
     64 
     65    try {
     66        var d = iframe.contentDocument;
     67 
     68        var div = d.createElement('div');
     69        d.body.appendChild(div);
     70 
     71        var s = div.attachShadow({mode: 'open'});
     72 
     73        var div2 = d.createElement('div');
     74        s.appendChild(div2);
     75 
     76        var inp = d.createElement('input');
     77        inp.setAttribute('type', 'text');
     78        inp.setAttribute('id', 'inpid');
     79        div2.appendChild(inp);
     80 
     81        div.addEventListener('click', A_05_01_01_T2.step_func(function (event) {
     82            assert_equals(event.target.tagName, 'DIV', 'Information about event target crossing ' +
     83                    'the shadow boundaries should be adjusted');
     84        }), false);
     85 
     86        var event = d.createEvent('HTMLEvents');
     87        event.initEvent ("click", true, false);
     88        inp.dispatchEvent(event);
     89    } finally {
     90        iframe.parentNode.removeChild(iframe);
     91    }
     92    A_05_01_01_T2.done();
     93    });
     94 });
     95 </script>
     96 </body>
     97 </html>