1<!DOCTYPE html> 2<html> 3<head><title> 4Tests blur/focus events with modal dialogs 5</title></head> 6<script> 7var failed = ""; 8function failBlur() { 9 failed = "blur"; 10} 11function failFocus() { 12 failed = "focus"; 13} 14 15var inputElement; 16 17function test() { 18 inputElement = document.getElementById("i") 19 inputElement.focus(); 20 inputElement.addEventListener("blur", failBlur, false); 21 inputElement.addEventListener("focus", failFocus, false); 22 window.showModalDialog("modal-dialog-blur-selfclose.html"); 23 if (failed) { 24 document.getElementById("status").innerHTML = "FAIL, " + failed; 25 } else { 26 document.getElementById("status").innerHTML = "SUCCESS"; 27 } 28} 29</script> 30<body onload="test()"> 31<input id="i"></input> 32<div id="status">RUNNING...</div> 33</body> 34</html> 35