the-end.html (2172B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>The end</title> 4 <link rel=help href="https://html.spec.whatwg.org/multipage/#the-end"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <div id="log"></div> 8 <script> 9 async_test(function() { 10 document.addEventListener("DOMContentLoaded", this.step_func_done(function(e) { 11 assert_equals(e.type, "DOMContentLoaded"); 12 assert_true(e.bubbles, "bubbles should be true"); 13 assert_false(e.cancelable, "cancelable should be false"); 14 assert_equals(e.target, document, "target should be document"); 15 assert_true(e.isTrusted, "isTrusted should be true"); 16 assert_class_string(e, "Event"); 17 })); 18 }, "DOMContentLoaded"); 19 20 async_test(function() { 21 window.addEventListener("load", this.step_func_done(function(e) { 22 assert_equals(e.type, "load"); 23 assert_false(e.bubbles, "bubbles should be false"); 24 assert_false(e.cancelable, "cancelable should be false"); 25 assert_equals(e.target, document, "target should be document"); 26 assert_true(e.isTrusted, "isTrusted should be true"); 27 assert_class_string(e, "Event"); 28 })); 29 }, "load"); 30 31 async_test(function() { 32 window.addEventListener("pageshow", this.step_func_done(function(e) { 33 assert_equals(e.type, "pageshow"); 34 35 // https://github.com/whatwg/html/issues/6794 36 assert_true(e.bubbles, "bubbles should be true"); 37 assert_true(e.cancelable, "cancelable should be true"); 38 39 assert_equals(e.target, document, "target should be document"); 40 assert_true(e.isTrusted, "isTrusted should be true"); 41 assert_class_string(e, "PageTransitionEvent"); 42 })); 43 }, "pageshow"); 44 45 async_test(function() { 46 var seen_dcl = false; 47 var seen_load = false; 48 document.addEventListener("DOMContentLoaded", this.step_func(function() { 49 seen_dcl = true; 50 })); 51 window.addEventListener("load", this.step_func(function() { 52 seen_load = true; 53 assert_true(seen_dcl, "DOMContentLoaded should be fired before load"); 54 })); 55 window.addEventListener("pageshow", this.step_func_done(function() { 56 assert_true(seen_load, "load should be fired before pageshow") 57 })); 58 }, "order"); 59 </script>