1<html> 2<head> 3<script src="resources/print.js"></script> 4</head> 5 6<body> 7<p>This page tests the beforeload event on script elements. You should see a PASS message below if everything 8works.</p> 9<hr> 10<div id='console'></div> 11 12<script> 13if (window.layoutTestController) 14 layoutTestController.dumpAsText(); 15 16function beforeLoadFunc() 17{ 18 print("PASS", "green"); 19 event.preventDefault(); 20} 21 22document.body.addEventListener("beforeload", beforeLoadFunc, true); 23var elt = document.createElement("script"); 24elt.setAttribute("src", "resources/fail.js"); 25document.body.appendChild(elt); 26</script> 27 28</body> 29</html> 30