document.getElementsByName-liveness.html (919B)
1 <!DOCTYPE html> 2 <title>Document.getElementsByName: liveness</title> 3 <link rel="author" title="Intel" href="http://www.intel.com"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <div id="log"></div> 7 <script> 8 test(function() { 9 var input = document.createElement("input"), 10 embed = document.createElement("embed"); 11 input.setAttribute("name", "test"); 12 input.setAttribute("type", "text"); 13 embed.setAttribute("name", "test"); 14 document.body.appendChild(input); 15 this.add_cleanup(function() { document.body.removeChild(input) }); 16 var e = document.getElementsByName("test"); 17 assert_true(e instanceof NodeList); 18 assert_equals(e.length, 1); 19 20 document.body.appendChild(embed); 21 assert_equals(e.length, 2); 22 23 document.body.removeChild(embed); 24 assert_equals(e.length, 1); 25 }, "Document.getElementsByName() should be a live collection"); 26 </script>