11cb0ef41Sopenharmony_ci<!DOCTYPE html> 21cb0ef41Sopenharmony_ci<script src="/resources/testharness.js"></script> 31cb0ef41Sopenharmony_ci<script src="/resources/testharnessreport.js"></script> 41cb0ef41Sopenharmony_ci<!-- 51cb0ef41Sopenharmony_ci This test is adopted from Olli Pettay's test case at 61cb0ef41Sopenharmony_ci http://mozilla.pettay.fi/shadow_focus.html 71cb0ef41Sopenharmony_ci--> 81cb0ef41Sopenharmony_ci<div id="host"></div> 91cb0ef41Sopenharmony_ci<input id="lightInput"> 101cb0ef41Sopenharmony_ci<script> 111cb0ef41Sopenharmony_ciconst root = host.attachShadow({ mode: "closed" }); 121cb0ef41Sopenharmony_ciroot.innerHTML = "<input id='shadowInput'>"; 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ciasync_test((test) => { 151cb0ef41Sopenharmony_ci root.getElementById("shadowInput").focus(); 161cb0ef41Sopenharmony_ci window.addEventListener("focus", test.step_func_done((e) => { 171cb0ef41Sopenharmony_ci assert_equals(e.relatedTarget, host); 181cb0ef41Sopenharmony_ci }, "relatedTarget should be pointing to shadow host."), true); 191cb0ef41Sopenharmony_ci lightInput.focus(); 201cb0ef41Sopenharmony_ci}, "relatedTarget should not leak at capturing phase, at window object."); 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ciasync_test((test) => { 231cb0ef41Sopenharmony_ci root.getElementById("shadowInput").focus(); 241cb0ef41Sopenharmony_ci lightInput.addEventListener("focus", test.step_func_done((e) => { 251cb0ef41Sopenharmony_ci assert_equals(e.relatedTarget, host); 261cb0ef41Sopenharmony_ci }, "relatedTarget should be pointing to shadow host."), true); 271cb0ef41Sopenharmony_ci lightInput.focus(); 281cb0ef41Sopenharmony_ci}, "relatedTarget should not leak at target."); 291cb0ef41Sopenharmony_ci 301cb0ef41Sopenharmony_ci</script> 31