<!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>
