directmanipulation: Return S_OK form viewport_SetViewportOptions stub.
[wine/zf.git] / dlls / mshtml / tests / exectest.html
blob18c6a48c6aa839e195a59597faed216679040d57
1 <html>
2 <body>
3 Script execution test
4 <div id="b1"></div>
5 <div id="b2"></div>
6 <div id="b3"></div>
7 <script id="emptyscript"></script>
8 <script id="put_text_script">2+2</script>
9 <script>
10 function ok(b, msg) {
11 return external.ok(b, msg);
14 var executed = false;
15 var extern_cnt = 0;
16 var exec_cnt;
18 function testWriteScript() {
19 var len = document.getElementsByTagName('div').length;
20 ok(len === 3, "init length = " + len);
22 document.write("<script>"
23 + "var len = document.getElementsByTagName('div').length;"
24 + "ok(len === 3, 'unexpected length ' + len);"
25 + "executed = true;"
26 + "<" + "/script>");
28 len = document.getElementsByTagName('script').length;
29 ok(len === 4, "script col length = " + len);
30 ok(executed, "written script not executed");
33 function testPutSrc() {
34 var elem = document.getElementById("emptyscript");
36 ok(extern_cnt === 0, "extern_cnt = " + extern_cnt + " expected 0");
37 elem.src = "externscr.js";
38 ok(extern_cnt === 0, "extern_cnt = " + extern_cnt + " expected 0");
41 function testPutText() {
42 var elem = document.getElementById("put_text_script");
44 exec_cnt = 0;
45 elem.text = "exec_cnt++;";
46 ok(exec_cnt === 1, "put_text_script exec_cnt " + exec_cnt);
48 exec_cnt = 0;
49 elem.text = "exec_cnt++;";
50 ok(exec_cnt === 1, "put_text_script exec_cnt " + exec_cnt);
53 try {
54 testWriteScript();
55 testPutSrc();
56 testPutText();
57 }catch(e) {
58 ok(false, "Got an exception " + e.message);
61 function testPutSrc2() {
62 var elem, elem2;
64 elem = document.createElement("script");
65 elem.src = "externscr.js";
66 ok(extern_cnt === 1, "extern_cnt = " + extern_cnt + " expected 1");
67 document.body.appendChild(elem);
68 ok(extern_cnt === 2, "extern_cnt = " + extern_cnt + " expected 2");
70 elem = document.createElement("script");
71 document.body.appendChild(elem);
72 ok(extern_cnt === 2, "extern_cnt = " + extern_cnt + " expected 2");
73 elem.src = "externscr.js";
74 ok(extern_cnt === 3, "extern_cnt = " + extern_cnt + " expected 3");
76 elem2 = document.createElement("div");
77 elem = document.createElement("script");
78 elem.src = "externscr.js";
79 ok(extern_cnt === 3, "extern_cnt = " + extern_cnt + " expected 3");
80 elem2.appendChild(elem);
81 document.body.appendChild(elem2);
82 ok(extern_cnt === 4, "extern_cnt = " + extern_cnt + " expected 4");
85 function testPutText2() {
86 var elem;
88 elem = document.createElement("script");
89 exec_cnt = 0;
90 elem.text = "exec_cnt++;";
91 ok(exec_cnt === 0, "script exec_cnt " + exec_cnt);
93 document.body.appendChild(elem);
94 ok(exec_cnt === 1, "script exec_cnt " + exec_cnt);
95 exec_cnt = 0;
96 elem.text = "exec_cnt++;";
97 ok(exec_cnt === 1, "script exec_cnt " + exec_cnt);
99 elem.src = "externscr.js";
100 ok(extern_cnt === 5, "extern_cnt = " + extern_cnt + " expected 5");
102 exec_cnt = 0;
103 ok(extern_cnt === 5, "> extern_cnt = " + extern_cnt + " expected 5");
104 elem.text = "exec_cnt++;"; /* forces evaluation, but src will be executed */
105 ok(exec_cnt === 0, "script exec_cnt " + exec_cnt);
106 ok(extern_cnt === 6, "< extern_cnt = " + extern_cnt + " expected 6");
107 elem.text = "exec_cnt++;"; /* forces evaluation, but src will be executed */
108 ok(exec_cnt === 0, "script exec_cnt " + exec_cnt);
109 ok(extern_cnt === 7, "< extern_cnt = " + extern_cnt + " expected 6");
111 elem = document.createElement("script");
112 exec_cnt = 0;
113 elem.text = "exec_cnt++;";
114 ok(exec_cnt === 0, "script exec_cnt " + exec_cnt);
115 elem.src = "externscr.js";
116 ok(extern_cnt === 7, "extern_cnt = " + extern_cnt + " expected 7");
118 document.body.appendChild(elem);
119 ok(exec_cnt === 0, "script exec_cnt " + exec_cnt);
120 ok(extern_cnt === 8, "extern_cnt = " + extern_cnt + " expected 8");
123 document.body.onload = function() {
124 ok(extern_cnt === 1, "extern_cnt = " + extern_cnt);
125 try {
126 testPutSrc2();
127 testPutText2();
128 }catch(e) {
129 ok(false, "got an exception " + e.message);
132 external.reportSuccess();
134 </script>
135 <script>
136 ok(extern_cnt === 1, "extern_cnt = " + extern_cnt);
137 </script>
138 <div id="a1"></div>
139 <div id="a2"></div>
140 <div id="b3"></div>
141 </body>
142 </html>