test-document-readiness-exist.html (1810B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8" /> 5 <title>document.readyState values exist during a navigation</title> 6 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> 7 <link rel="help" href="http://www.w3.org/TR/html5/dom.html#resource-metadata-management"/> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script> 11 setup({ explicit_done: true }); 12 var has_loading = (document.readyState == "loading"); 13 var has_interactive = (document.readyState == "interactive"); 14 var has_complete = (document.readyState == "complete"); 15 16 document.onreadystatechange = function() 17 { 18 if (document.readyState == "loading") 19 { 20 has_loading = true; 21 } 22 if (document.readyState == "interactive") 23 { 24 has_interactive = true; 25 } 26 if (document.readyState = "complete") 27 { 28 has_complete = true; 29 } 30 }; 31 32 function onload_test() 33 { 34 test(function () { assert_true(has_loading); }, "Document readiness has loading state."); 35 test(function () { assert_true(has_interactive); }, "Document readiness has interactive state."); 36 test(function () { assert_true(has_complete); }, "Document readiness has complete state."); 37 done(); 38 } 39 </script> 40 41 </head> 42 <body onload="onload_test();"> 43 <h1>Description</h1> 44 <p>This test validates that the "loading", "interactive" and "complete" 45 document.readyState states are available during a navigation.</p> 46 <p>Refresh this page to guarantee all readyState phases.</p> 47 <div id="log"></div> 48 </body> 49 </html>