select-named-getter.html (1445B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>Absence of a named getter on HTMLSelectElement</title> 4 <script src=/resources/testharness.js></script> 5 <script src=/resources/testharnessreport.js></script> 6 <div id=log></div> 7 <select id=select> 8 <option id=op1>A</option> 9 <option name=op2>B</option> 10 <option id=op3 name=op4>C</option> 11 <option id=>D</option> 12 <option name=>D</option> 13 </select> 14 <script> 15 test(function() { 16 var select = document.getElementById("select"); 17 assert_equals(select.op1, undefined); 18 assert_false("op1" in select); 19 assert_equals(select.namedItem("op1"), select.children[0]); 20 }, "Option with id") 21 22 test(function() { 23 var select = document.getElementById("select"); 24 assert_equals(select.op2, undefined); 25 assert_false("op2" in select); 26 assert_equals(select.namedItem("op2"), select.children[1]); 27 }, "Option with name") 28 29 test(function() { 30 var select = document.getElementById("select"); 31 assert_equals(select.op3, undefined); 32 assert_false("op3" in select); 33 assert_equals(select.namedItem("op3"), select.children[2]); 34 35 assert_equals(select.op4, undefined); 36 assert_false("op4" in select); 37 assert_equals(select.namedItem("op4"), select.children[2]); 38 }, "Option with name and id") 39 40 test(function() { 41 var select = document.getElementById("select"); 42 assert_equals(select[""], undefined); 43 assert_false("" in select); 44 assert_equals(select.namedItem(""), null); 45 }, "Empty string name"); 46 </script>