event-handler-onresize.html (1399B)
1 <!DOCTYPE html> 2 <title>HTMLBodyElement.onresize</title> 3 <link rel="author" title="His-Name-Is-Joof" href="mailto:jeffrharrison@gmail.com"> 4 <link rel="help" href="https://html.spec.whatwg.org/multipage/#handler-window-onresize"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <div id="log"></div> 8 <script> 9 var t = async_test("body.onresize should set the window.onresize handler") 10 window.onresize = t.step_func(function() { 11 assert_unreached("This handler should be overwritten.") 12 }) 13 14 var body = document.createElement("body") 15 body.onresize = 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 window.dispatchEvent(new Event('resize')); 21 22 t = async_test("document.onresize should set the document.onresize handler"); 23 document.onresize = t.step_func(function(e) { 24 assert_equals(e.currentTarget, document, 25 "The event should be fired at the document") 26 t.done() 27 }) 28 document.dispatchEvent(new Event('resize')); 29 30 t = async_test("meta.onresize should set the meta.onresize handler"); 31 var meta = document.createElement("meta") 32 meta.onresize = t.step_func(function(e) { 33 assert_equals(e.currentTarget, meta, 34 "The event should be fired at the <meta> object") 35 t.done() 36 }) 37 meta.dispatchEvent(new Event('resize')); 38 </script>