any-link-pseudo.html (1161B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>CSS Selectors Invalidation: :any-link</title> 5 <link rel="author" title="Victoria Su" href="mailto:victoriaytsu@google.com"> 6 <link rel="help" href="https://drafts.csswg.org/selectors-4/#the-any-link-pseudo"> 7 <meta name="assert" content="This tests that the :any-link selector is effective"> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <style> 11 #link { background-color: red } 12 #link:any-link { background-color: green } 13 #link + div { color: pink } 14 </style> 15 <a id="link">This link should have a green background.</a> 16 <div> 17 <div></div> 18 <div></div> 19 <div></div> 20 <div></div> 21 </div> 22 <script> 23 test(function() { 24 var red = "rgb(255, 0, 0)"; 25 var green = "rgb(0, 128, 0)"; 26 27 assert_equals(getComputedStyle(link).backgroundColor, red); 28 29 link.href = "not-visited.html"; 30 31 assert_equals(getComputedStyle(link).backgroundColor, green); 32 }, "Style was recalculated for the :any-link pseudo class."); 33 34 </script> 35 </head> 36 </html>