/test/web-platform-tests/to-upstream/html/semantics/scripting-1/the-script-element/execution-timing/async-script-depending-on-previous-sync-dont-upstream.html

https://github.com/jsdom/jsdom · HTML · 37 lines · 32 code · 5 blank · 0 comment · 0 complexity · c6a7bf557731c07e76b4ca6fe5d49705 MD5 · raw file

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>An async script executes after a previous sync script is executed</title>
  5. <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  6. <meta description="This test ensures an async script executes after a previous sync script is executed" />
  7. <link rel="author" title="Jesus David Garcia Gomez" href="mailto:jdgarcia@outlook.com" />
  8. <link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-script-async"/>
  9. <script src="/resources/testharness.js"></script>
  10. <script src="/resources/testharnessreport.js"></script>
  11. </head>
  12. <body>
  13. <div id=log></div>
  14. <script type="text/javascript">
  15. var t = async_test("An async script executes after a previous sync script is executed");
  16. function timeout()
  17. {
  18. t.step(function(){ assert_equals(document.getElementById("testresult").innerHTML, "run")});
  19. t.done();
  20. }
  21. var timer = setTimeout(timeout, 4000);
  22. function log(text)
  23. {
  24. var textNode = document.createTextNode(text);
  25. document.getElementById("testresult").appendChild(textNode);
  26. }
  27. </script>
  28. <span id="testresult"></span>
  29. <script src="sync.py?sec=3"></script>
  30. <script src="async.js" async></script>
  31. </body>
  32. </html>