out-of-bounds-selectedindex.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <html class="reftest-wait">
  2. <head><title>Testcase for bug 471741</title>
  3. <script>
  4. var result = "Result: "
  5. function sel(id,index) {
  6. var el = document.getElementById(id)
  7. el.selectedIndex = index;
  8. result += el.selectedIndex + ' ';
  9. }
  10. </script>
  11. </head>
  12. <body id="body">
  13. <select size="4" id="m1" multiple="multiple">
  14. <option value="Item0">Item0</option>
  15. <option selected="selected" value="Item1">Item1</option>
  16. <option value="Item2">Item2</option>
  17. <option value="Item3">Item3</option>
  18. <option value="Item4">Item4</option>
  19. </select>
  20. <select size="1" id="s1">
  21. <option value="Item0">Item0</option>
  22. <option selected="selected" value="Item1">Item1</option>
  23. <option value="Item2">Item2</option>
  24. <option value="Item3">Item3</option>
  25. <option value="Item4">Item4</option>
  26. </select>
  27. <select size="4" id="m2" multiple="multiple">
  28. <option value="Item0">Item0</option>
  29. </select>
  30. <select size="1" id="s2">
  31. <option value="Item0">Item0</option>
  32. </select>
  33. <select size="4" id="m3" multiple="multiple"></select>
  34. <select size="1" id="s3"></select>
  35. <br>
  36. <select size="4" id="r2m1" multiple="multiple">
  37. <option value="Item0">Item0</option>
  38. <option selected="selected" value="Item1">Item1</option>
  39. <option value="Item2">Item2</option>
  40. <option value="Item3">Item3</option>
  41. <option value="Item4">Item4</option>
  42. </select>
  43. <select size="1" id="r2s1">
  44. <option value="Item0">Item0</option>
  45. <option selected="selected" value="Item1">Item1</option>
  46. <option value="Item2">Item2</option>
  47. <option value="Item3">Item3</option>
  48. <option value="Item4">Item4</option>
  49. </select>
  50. <select size="4" id="r2m2" multiple="multiple">
  51. <option value="Item0">Item0</option>
  52. </select>
  53. <select size="1" id="r2s2">
  54. <option value="Item0">Item0</option>
  55. </select>
  56. <select size="4" id="r2m3" multiple="multiple"></select>
  57. <select size="1" id="r2s3"></select>
  58. <br>
  59. <select size="4" id="r3m1" multiple="multiple">
  60. <option value="Item0">Item0</option>
  61. <option selected="selected" value="Item1">Item1</option>
  62. <option value="Item2">Item2</option>
  63. <option value="Item3">Item3</option>
  64. <option value="Item4">Item4</option>
  65. </select>
  66. <select size="1" id="r3s1">
  67. <option value="Item0">Item0</option>
  68. <option selected="selected" value="Item1">Item1</option>
  69. <option value="Item2">Item2</option>
  70. <option value="Item3">Item3</option>
  71. <option value="Item4">Item4</option>
  72. </select>
  73. <select size="4" id="r3m2" multiple="multiple">
  74. <option value="Item0">Item0</option>
  75. </select>
  76. <select size="1" id="r3s2">
  77. <option value="Item0">Item0</option>
  78. </select>
  79. <select size="4" id="r3m3" multiple="multiple"></select>
  80. <select size="1" id="r3s3"></select>
  81. <br>
  82. <div id="result"></div>
  83. <script>
  84. sel('m1', 10)
  85. sel('s1', 10)
  86. sel('m2', 99999)
  87. sel('s2', 99999)
  88. sel('m3', 10)
  89. sel('s3', 10)
  90. sel('r2m1', -2)
  91. sel('r2s1', -2)
  92. sel('r2m2', -12)
  93. sel('r2s2', -12)
  94. sel('r2m3', -2)
  95. sel('r2s3', -2)
  96. sel('r3m1', -2)
  97. sel('r3s1', -2)
  98. sel('r3m2', -12)
  99. sel('r3s2', -12)
  100. sel('r3m3', -2)
  101. sel('r3s3', -2)
  102. sel('r3m1', 0)
  103. sel('r3s1', 0)
  104. sel('r3m2', 0)
  105. sel('r3s2', 0)
  106. sel('r3m3', 0)
  107. sel('r3s3', 0)
  108. document.getElementById('result').innerHTML = result;
  109. var flush = document.documentElement.offsetHeight;
  110. document.documentElement.className='';
  111. </script>
  112. </body>
  113. </html>