22
edits
m (→First test) |
m (→Second test) |
||
Line 35: | Line 35: | ||
Here follow the partial source code of this webpage : | Here follow the partial source code of this webpage : | ||
&# | <!doctype html> | ||
&# | <html> | ||
&# | <head> | ||
&# | <title> Test 2 </title> | ||
&# | <script> var test2 = "Test 2 :\n\n"; </script> | ||
&# | <script> document.addEventListener("DOMContentLoaded", | ||
function(){ | function(){ | ||
test2 += "\t<font style="color: red;">DOMContentLoaded</font>\n"; | test2 += "\t<font style="color: red;">DOMContentLoaded</font>\n"; | ||
}, false); | }, false); | ||
&# | </script> | ||
&# | <script <font style="color: green;">defer</font>> test2 += "\t<font style="color: red;">Inline HEAD deferred</font>\n"; </script> | ||
&# | <script> test2 += "\t<font style="color: red;">Inline HEAD</font>\n"; </script> | ||
&# | <script src="script1.js" <font style="color: green;">defer</font>> | ||
// <font style="color: red;">External HEAD deferred (script1.js)</font> | // <font style="color: red;">External HEAD deferred (script1.js)</font> | ||
&# | </script> | ||
&# | <script src="script2.js"> | ||
// <font style="color: red;">External HEAD (script2.js)</font> | // <font style="color: red;">External HEAD (script2.js)</font> | ||
&# | </script> | ||
&# | <script> | ||
// <font style="color: red;">Dynamic DOM insertion of a script (script3.js)</font> | // <font style="color: red;">Dynamic DOM insertion of a script (script3.js)</font> | ||
head = document.getElementsByTagName('head')[0]; | head = document.getElementsByTagName('head')[0]; | ||
Line 64: | Line 64: | ||
script4.setAttribute('src', 'script4.js'); | script4.setAttribute('src', 'script4.js'); | ||
head.appendChild(script4); | head.appendChild(script4); | ||
&# | </script> | ||
&# | <script <font style="color: green;">defer</font>> | ||
// <font style="color: red;">Deferred dynamic DOM insertion of a script (script5.js)</font> | // <font style="color: red;">Deferred dynamic DOM insertion of a script (script5.js)</font> | ||
head = document.getElementsByTagName('head')[0]; | head = document.getElementsByTagName('head')[0]; | ||
Line 76: | Line 76: | ||
script6.setAttribute('src', 'script6.js'); | script6.setAttribute('src', 'script6.js'); | ||
head.appendChild(script6); | head.appendChild(script6); | ||
&# | </script> | ||
&# | </head> | ||
&# | <body onload="test2 += '\t<font style="color: red;">Body onLoad</font>\n';"> | ||
&# | <script <font style="color: green;">defer</font>> test2 += "\t<font style="color: red;">Inline BODY deferred</font>\n"; </script> | ||
&# | <script> test2 += "\t<font style="color: red;">Inline BODY</font>\n"; </script> | ||
... other body content ... | ... other body content ... | ||
Line 88: | Line 88: | ||
... other body content ... | ... other body content ... | ||
&# | <script src="script7.js" <font style="color: green;">defer</font>> | ||
// <font style="color: red;">External BODY deferred (script7.js)</font> | // <font style="color: red;">External BODY deferred (script7.js)</font> | ||
&# | </script> | ||
&# | <script src="script8.js"> | ||
// <font style="color: red;">External BODY (script8.js)</font> | // <font style="color: red;">External BODY (script8.js)</font> | ||
&# | </script> | ||
&# | </body> | ||
&# | </html> | ||
By clicking the link "Launch test 2", a pop-up appears with a list in it. This list shows the order of <tt>script</tt> elements loaded during the session. | By clicking the link "Launch test 2", a pop-up appears with a list in it. This list shows the order of <tt>script</tt> elements loaded during the session. |
edits