summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/select/set-option-index-text.html
blob: 5390a9df84a8ae7d7d57e34163e10893ee9e9915 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<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>