summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/var-name-conflict-in-form-event-handler.html
blob: 9036db62e6dd4b91e27f5b19e98b496900de189a (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
27
28
<html>
<body>
<p>This tests that a locally scoped variable in an event handler of a form
takes precedence over items of form.

<form>
<select onChange="var value = this.value;this.options[0].selected=true; if(value=='C') document.getElementById('sourceViewDiv').innerHTML='This test: PASSED!'">
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
</select>

<div id='sourceViewDiv'>This test: FAILED</div>

<script>
if (window.testRunner)
  testRunner.dumpAsText();

var x=document.getElementsByTagName('select')[0];
x.options[2].selected=true;
var evt = document.createEvent("HTMLEvents");
evt.initEvent("change", true, true);
x.dispatchEvent(evt);
</script>
</form>

</body>
</html>