test-003.html (1756B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Shadow DOM Test: A_05_02_03</title> 5 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> 6 <link rel="help" href="https://w3c.github.io/webcomponents/spec/shadow/#event-relatedtarget-retargeting"> 7 <meta name="assert" content="The value of the Event object's relatedTarget attribute must be the result of the retargeting algorithm with the event's currentTarget and relatedTarget as input. The result is called a relative related target."> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="../../../../html/resources/common.js"></script> 11 <script src="../../../resources/shadow-dom-utils.js"></script> 12 </head> 13 <body> 14 <div id="log"></div> 15 <script> 16 var A_05_02_03_T01 = async_test('A_05_02_03_T01'); 17 18 A_05_02_03_T01.step(unit(function (ctx) { 19 20 var d = newRenderedHTMLDocument(ctx); 21 22 var host = d.createElement('div'); 23 host.setAttribute('style', 'height:50%; width:100%'); 24 host.setAttribute('id', 'host'); 25 d.body.appendChild(host); 26 27 //Shadow root to play with 28 var s = host.attachShadow({mode: 'open'}); 29 30 var div1 = d.createElement('div'); 31 div1.setAttribute('style', 'height:100%; width:100%'); 32 div1.setAttribute('id', 'div1'); 33 s.appendChild(div1); 34 35 host.addEventListener('mouseover', A_05_02_03_T01.step_func(function(event) { 36 assert_unreached('Event listeners shouldn\'t be invoked if relative target and relative related target are the same'); 37 }), false); 38 39 var evt = new MouseEvent("mouseover", 40 { relatedTarget: div1, relatedTargetScoped: true }); 41 div1.dispatchEvent(evt); 42 43 A_05_02_03_T01.done(); 44 })); 45 </script> 46 </body> 47 </html>