document.links.html (730B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>Document.links</title> 4 <link rel="author" title="Intel" href="http://www.intel.com"> 5 <script src=/resources/testharness.js></script> 6 <script src=/resources/testharnessreport.js></script> 7 <div id=log></div> 8 <div id=test> 9 <a href=""></a> 10 <a href=""></a> 11 </div> 12 <script> 13 test(function() { 14 var div = document.getElementById("test"); 15 var links = document.links; 16 assert_true(links instanceof HTMLCollection); 17 assert_equals(links.length, 2); 18 19 var a = document.createElement("a"); 20 a.setAttribute("href", ""); 21 div.appendChild(a); 22 assert_equals(links.length, 3); 23 24 div.removeChild(a); 25 assert_equals(links.length, 2); 26 }, "Document.links should be a live collection"); 27 </script>