<p>"Option 1" and "Option 2" should be in correct order.</p>
<select size=2>
<option>ERROR</option>
<option>Option 2</option>
</select>
<script>
  if (window.testRunner)
    testRunner.dumpAsText();

  var option1 = document.getElementsByTagName("option")[0];
  var option2 = document.getElementsByTagName("option")[1];
  
  option1.text = "Option 1";
  try {
    option1.index = 1;
    if (option1.index != 0)
      document.write("<p>FAIL: An attempt to set HTMLOptionElement.index was not ignored.");

    if (window.testRunner) {
      document.write(document.getElementsByTagName("option")[0].text + "<br>");
      document.write(document.getElementsByTagName("option")[1].text + "<br>");
    }
  } catch (ex) {
    document.write("<p>FAIL: Exception on setting an index: " + ex + "</p>");
  }
</script>
