534804-1.html (979B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset='utf-8'> 5 <title>dynamic sibling selector testcase</title> 6 <script> 7 window.onload = function() { 8 document.getElementById("adjacent").appendChild(document.createTextNode("PASS: You should see this")); 9 document.getElementById("general").appendChild(document.createTextNode("PASS: You should also see this")); 10 }; 11 </script> 12 <style> 13 .test { 14 background: #fcc; 15 } 16 #adjacent:not(:empty), #general:not(:empty) { 17 background: #cfc; 18 } 19 #adjacent:not(:empty) + .test { 20 display: none; 21 } 22 #general:not(:empty) ~ .test { 23 display: none; 24 } 25 </style> 26 </head> 27 <body> 28 <div> 29 <div id="adjacent"></div> 30 <div class="test"> 31 FAIL: You should NOT see me. 32 </div> 33 </div> 34 35 <div> 36 <div id="general"></div> 37 <div class="test"> 38 FAIL: You should NOT see me either. 39 </div> 40 <div class="test"> 41 FAIL: You should NOT even see me. 42 </div> 43 </div> 44 </body> 45 </html>