focus-within-012.html (1229B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS Test: :focus-within selector</title> 6 <link rel="author" title="Ethan Lin" href="mailto:ethlin@mozilla.com"> 7 <link rel="author" title="Mozilla" href="https://www.mozilla.org"> 8 <link rel="help" href="https://drafts.csswg.org/selectors-4/#focus-within-pseudo"> 9 <meta name="assert" content="Test checks :focus-within should not apply after element removed."> 10 <link rel="match" href="focus-within-012-ref.html"> 11 <style> 12 div { 13 border: solid 15px green; 14 outline: none; 15 } 16 div:focus-within { 17 border-color: red; 18 } 19 </style> 20 </head> 21 <body> 22 <p>Test passes if, when the element is focused and then removed, the outer element should change to green.</p> 23 <div id="parent"> 24 <div id="child" tabindex="1"></div> 25 </div> 26 <script> 27 var child = document.getElementById('child'); 28 child.focus(); 29 document.body.offsetWidth; 30 var parent = document.getElementById("parent"); 31 parent.removeChild(child); 32 document.body.offsetWidth; 33 document.documentElement.classList.remove('reftest-wait'); 34 </script> 35 </body> 36 </html>