b0dedf9fac70df51fbb6dbd10bd99e6745f7ca14
[WebKit-https.git] / LayoutTests / fast / events / event-attribute.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../fast/js/resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <input onbeforeload="1" onabort="1">
10 <script src="resources/shouldnotexecute.js" onbeforeload="debug('cancelled onbeforeload async'); return false;" async></script>
11
12 <script>
13 description('Test that setting event handlers with attribute works.');
14
15 var elementTags = ["img", "script", "video", "div", "form", "input"];
16 var eventNames = ["onclick", "oncontextmenu", "ondblclick", "onmousedown",
17 "onmousemove", "onmouseout", "onmouseover", "onmouseup", "onmousewheel",
18 "onfocus", "onblur", "onkeydown", "onkeypress", "onkeyup", "onscroll",
19 "onbeforecut", "oncut", "onbeforecopy", "oncopy", "onbeforepaste", "onpaste",
20 "ondragenter", "ondragover", "ondragleave", "ondrop", "ondragstart", "ondrag",
21 "ondragend", "onselectstart", "onsubmit", "onerror", "oninput", "oninvalid",
22 "ontouchstart", "ontouchmove", "ontouchend", "ontouchcancel",
23 "onwebkitfullscreenchange", "onwebkitfullscreenerror", "onabort", "onchange",
24 "onreset", "onselect", "onload"];
25
26 for (var i = 0; i < elementTags.length; i++) {
27     var element = document.createElement(elementTags[i]);
28     for (var j = 0; j < eventNames.length; j++) {
29         element.setAttribute(eventNames[j], "1");
30         shouldBe('/*' + elementTags[i] + '*/ typeof (element["' + eventNames[j] + '"])', '"function"');
31     }
32 }
33
34 </script>
35 <script src="../../fast/js/resources/js-test-post.js"></script>
36 </body>
37 </html>