body-onload.html (790B)
1 <!DOCTYPE html> 2 <title>HTMLBodyElement.onload</title> 3 <link rel="author" title="Boris Zbarsky" href="mailto:bzbarsky@mit.edu"> 4 <link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"> 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/#handler-window-onload"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <div id="log"></div> 9 <script> 10 var t = async_test("body.onload should set the window.onload handler") 11 window.onload = t.step_func(function() { 12 assert_unreached("This handler should be overwritten.") 13 }) 14 var b = document.createElement("body") 15 b.onload = t.step_func(function(e) { 16 assert_equals(e.currentTarget, window, 17 "The event should be fired at the window.") 18 t.done() 19 }) 20 </script>