Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / script-add.html
blob407b31e5fedf7f914d4cc1a10a7f3371357a94aa
1 <html>
2 <head>
3 <script type="text/javascript">
4 function log(number)
6 var item = document.createElement("li");
7 item.appendChild(document.createTextNode("Loaded script " + number + "."));
8 document.getElementById("console").appendChild(item);
10 function test1()
12 var oHead = document.getElementsByTagName('head')[0];
13 var oScript = document.createElement('script');
14 oScript.setAttribute('type', 'text/javascript');
15 oHead.appendChild(oScript);
16 oScript.text = 'log("1"); test2();';
18 function test2()
20 var oHead = document.getElementsByTagName('head')[0];
21 var oScript = document.createElement('script');
22 oScript.setAttribute('type', 'text/javascript');
23 oHead.appendChild(oScript);
24 oScript.innerText = 'log("2"); test3();';
26 function test3()
28 var oScript = document.createElement('SCRIPT');
29 var oHead = document.getElementsByTagName('HEAD')[0];
30 oScript.setAttribute('type', 'text/javascript');
31 oScript.setAttribute('src', 'resources/script3.js');
32 oHead.appendChild(oScript);
34 function test4()
36 var oScript = document.createElement('SCRIPT');
37 var oHead = document.getElementsByTagName('HEAD')[0];
38 oScript.language = 'javascript';
39 oScript.src = 'resources/script4.js';
40 oHead.appendChild(oScript);
42 function test5()
44 var oScript = document.createElement('script');
45 var oBody = document.getElementsByTagName('body')[0];
46 oScript.setAttribute('type', 'text/javascript');
47 oScript.setAttribute('src', 'resources/script5.js');
48 oBody.appendChild(oScript);
50 function test()
52 if (window.testRunner) {
53 testRunner.dumpAsText();
54 testRunner.waitUntilDone();
57 test1();
59 </script>
60 </head>
61 <body onload="test()">
62 <p>This tests 5 different ways of dynamically loading a script by creating a script element.</p>
63 <p>If it works you should see 5 messages below about successfully loading a script.</p>
64 <hr>
65 <p><ol id="console"></ol></p>
66 </body>
67 </html>