OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html lang=en> |
| 3 <meta charset="utf-8"> |
| 4 <title>Selectors Level 4: focus-within with shadow DOM</title> |
| 5 <link rel="author" title="Keyong Li" href="mailto:kli79@bloomberg.net"> |
| 6 <link rel="author" title="Florian Rivoal" href="mailto:florian@rivoal.net"> |
| 7 <link rel="help" href="https://drafts.csswg.org/selectors-4/#focus-within-pseudo
"> |
| 8 <link rel="match" href="focus-within-shadow-001-ref.html"> |
| 9 <meta name="flags" content="interact dom"> |
| 10 <meta name="assert" content="Test that :focus-within applies to an ancestor of a
shadow host containing a focused element."> |
| 11 <style> |
| 12 #target:focus-within { |
| 13 border: solid 15px green; |
| 14 } |
| 15 </style> |
| 16 <body> |
| 17 <p>Test passes if there is a green rectangle below.</p> |
| 18 <div id="target"> |
| 19 <div> |
| 20 <div> |
| 21 <div> |
| 22 <div id="shadow-host"><strong>Skip this test, shadow DOM is not supporte
d.</strong></div> |
| 23 </div> |
| 24 </div> |
| 25 </div> |
| 26 </div> |
| 27 |
| 28 <template id="shadow-template"> |
| 29 <style> |
| 30 /* Suppress things that cannot be reproduced in the reference file */ |
| 31 :focus { |
| 32 outline: none; |
| 33 } |
| 34 </style> |
| 35 <div id="focusme" class="reftest-wait" onfocus="this.classList.toggle('reftest-w
ait');" tabindex="1"></div> |
| 36 </template> |
| 37 |
| 38 <script> |
| 39 var shadow = document.getElementById('shadow-host').createShadowRoot(); |
| 40 var template = document.getElementById('shadow-template'); |
| 41 var instance = document.importNode(template.content, true); |
| 42 shadow.appendChild(instance); |
| 43 window.setTimeout(function() { |
| 44 var focusme = shadow.getElementById('focusme'); |
| 45 focusme.focus(); |
| 46 }, 0); |
| 47 </script> |
| 48 </body> |
| 49 </html> |
OLD | NEW |