test_a_href_02.xhtml (1223B)
1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <!-- 3 https://bugzilla.mozilla.org/show_bug.cgi?id=620295 4 --> 5 <head> 6 <title>Test that the href property reflects xlink:href="" on 'a' elements</title> 7 <script src="/tests/SimpleTest/SimpleTest.js"></script> 8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 9 </head> 10 <body> 11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=620295">Mozilla Bug 620295</a> 12 <p id="display"></p> 13 <div id="content"> 14 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> 15 <a id="a" xlink:href="a"/> 16 </svg> 17 </div> 18 <pre id="test"> 19 <script><![CDATA[ 20 21 var a = document.getElementById("a"); 22 23 // Initial attribute value should be reflected in the href property 24 is(a.href.baseVal, "a", "Initial property value"); 25 26 // Updated attribute value should be reflected in the href property 27 a.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", "b"); 28 is(a.href.baseVal, "b", "Updated property value"); 29 30 // Modifying the href property should cause the attribute to be updated 31 a.href.baseVal = "c"; 32 is(a.getAttributeNS("http://www.w3.org/1999/xlink", "href"), "c", "Updated attribute value"); 33 34 ]]></script> 35 </pre> 36 </body> 37 </html>