summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/HTMLLinkElement/link-onload-before-page-load.html
blob: 417111d70cf338882966fe669d64fb1605c8304b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!DOCTYPE html>
<html>
<head>
<script src="resources/link-load-utilities.js"></script>
<script>
var expectedLoadEventTargets = ["link", "body"];

function didReceiveLoadEvent(elementName)
{
  var expectedTarget = expectedLoadEventTargets.shift();
  if (expectedTarget === elementName)
    testPassedAndNotifyDone("Fired Load event at " + elementName + ".");
  else {
    // We don't call testFailedAndNotifyDone() or testFinished() because we want to log additional Load events as it
    // may help towards debugging this test case.
    testFailed("Fired Load event at " + elementName + ", but should have fired it at " + expectedTarget + ".");
  }
}
</script>
<link rel="stylesheet" href="resources/stylesheet.css" onload="didReceiveLoadEvent('link')">
</head>
<body onload="didReceiveLoadEvent('body')">
<p>This tests that a Load event for an HTML Link element comes before the Load event for the window. This test PASSED if you see the word PASS below. Otherwise, it FAILED.</p>
<pre id="console"></pre>
</body>
</html>