href-attr-change-restyles.html (1302B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Test for bug 549797 - Removing href attribute doesn't remove link styling</title> 5 <style type="text/css"> 6 :link, :visited { 7 color:blue; 8 } 9 link { 10 display:block; 11 } 12 #link2::before { 13 content:"Test link 1"; 14 } 15 #link4::before { 16 content:"Test link 2"; 17 } 18 #link6::before { 19 content:"Test link 3"; 20 } 21 </style> 22 </head> 23 <body onload="run_test();"> 24 <script type="text/javascript"> 25 function run_test() 26 { 27 // Remove the href attributes of the links so they should be restyled as 28 // non-links. 29 document.getElementById("link1").removeAttribute("href"); 30 document.getElementById("link2").removeAttribute("href"); 31 32 // Add the href attribute to the links so they should be restyled as links. 33 document.getElementById("link3").href = "http://example.com/1"; 34 document.getElementById("link4").href = "http://example.com/1"; 35 document.getElementById("link5").setAttribute("href", ""); 36 document.getElementById("link6").setAttribute("href", ""); 37 } 38 </script> 39 <p> 40 <a id="link1" href="http://example.com/1">Test anchor 1</a> 41 <link id="link2" href="http://example.com/1"/> 42 <a id="link3">Test anchor 2</a> 43 <link id="link4"/> 44 <a id="link5">Test anchor 3</a> 45 <link id="link6"/> 46 </p> 47 </body> 48 </html>