1960db30aa6cae6ae7fa8d9d35295925180d2a86
[framework/web/webkit-efl.git] / LayoutTests / fast / dom / Window / script-tests / HTMLBodyElement-window-eventListener-attributes.js
1 description("This tests that setting window event listeners on the body, sets them on the window.");
2
3 function gc()
4 {
5     if (window.GCController)
6         return GCController.collect();
7
8     for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect)
9         var s = new String("");
10     }
11 }
12
13 var func = function() { }
14
15 document.body.onblur = func;
16 shouldBe("window.onblur", "func");
17 shouldBe("window.onblur", "document.body.onblur");
18
19 document.body.onfocus = func;
20 shouldBe("window.onfocus", "func");
21 shouldBe("window.onfocus", "document.body.onfocus");
22
23 document.body.onerror = func;
24 shouldBe("window.onerror", "func");
25 shouldBe("window.onerror", "document.body.onerror");
26
27 document.body.onload = func;
28 shouldBe("window.onload", "func");
29 shouldBe("window.onload", "document.body.onload");
30
31 document.body.onbeforeunload = func;
32 shouldBe("window.onbeforeunload", "func");
33 shouldBe("window.onbeforeunload", "document.body.onbeforeunload");
34
35 document.body.onhashchange = func;
36 shouldBe("window.onhashchange", "func");
37 shouldBe("window.onhashchange", "document.body.onhashchange");
38
39 document.body.onmessage = func;
40 shouldBe("window.onmessage", "func");
41 shouldBe("window.onmessage", "document.body.onmessage");
42
43 document.body.onoffline = func;
44 shouldBe("window.onoffline", "func");
45 shouldBe("window.onoffline", "document.body.onoffline");
46
47 document.body.ononline = func;
48 shouldBe("window.ononline", "func");
49 shouldBe("window.ononline", "document.body.ononline");
50
51 document.body.onresize = func;
52 shouldBe("window.onresize", "func");
53 shouldBe("window.onresize", "document.body.onresize");
54
55 document.body.onstorage = func;
56 shouldBe("window.onstorage", "func");
57 shouldBe("window.onstorage", "document.body.onstorage");
58
59 document.body.onunload = func;
60 shouldBe("window.onunload", "func");
61 shouldBe("window.onunload", "document.body.onunload");
62 window.onunload = null;
63
64 gc();
65
66 var successfullyParsed = true;