Upstream version 11.40.277.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / dom / inline-event-attributes-event-param-name.html
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <script>
4
5 description('Tests the name of the event parameter for inline event attributes');
6
7 function dispatchClick(element)
8 {
9     var clickEvent = document.createEvent('MouseEvent');
10     clickEvent.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
11     element.dispatchEvent(clickEvent);
12 }
13
14 var type;
15 var div = document.createElement('div');
16
17 // Clear out window.event so that we get the local event and not the global event.
18 div.setAttribute('onclick', 'window.event = undefined; type = typeof event');
19 dispatchClick(div);
20 shouldBeEqualToString('type', 'object')
21
22 div.setAttribute('onclick', 'type = typeof evt');
23 dispatchClick(div);
24 shouldBeEqualToString('type', 'undefined')
25
26 var SVG_NS = 'http://www.w3.org/2000/svg';
27 var svg = document.createElementNS(SVG_NS, 'circle');
28
29 // Clear out window.event so that we get the local event and not the global event.
30 svg.setAttribute('onclick', 'window.event = undefined; type = typeof event');
31 dispatchClick(svg);
32 shouldBeEqualToString('type', 'undefined')
33
34 svg.setAttribute('onclick', 'type = typeof evt');
35 dispatchClick(svg);
36 shouldBeEqualToString('type', 'object')
37
38 </script>