has-append-first-node.html (989B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <link rel="author" title="David Shin" href="mailto:dshin@mozilla.com"> 4 <link rel="help" href="https://drafts.csswg.org/selectors/#relational"> 5 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1874705"> 6 <link rel="match" href="../../reference/ref-filled-green-100px-square.xht"> 7 <style> 8 #dut { 9 width: 100px; 10 height: 100px; 11 background: red; 12 } 13 #dut:has(span) { 14 background: green; 15 } 16 </style> 17 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 18 <div id="dut"></div> 19 <script> 20 function raf() { 21 return new Promise(resolve => { 22 requestAnimationFrame(resolve); 23 }); 24 } 25 26 async function go() { 27 await raf(); 28 await raf(); 29 const df = document.createDocumentFragment(); 30 const t = document.createTextNode('\n'); 31 df.appendChild(t); 32 const s = document.createElement("span"); 33 df.appendChild(s); 34 dut.appendChild(df); 35 document.documentElement.className = ''; 36 } 37 38 go(); 39 </script> 40 </html>