Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / HTMLLinkElement / link-onload2.html
blob9e1a985090cf82e3b116c5a1eaa48c28c2df9c76
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="resources/link-load-utilities.js"></script>
5 <script>
6 var numberOfFiredLoadEvents = 0;
7 var expectedNumberOfFiredLoadEvents = 2;
9 function checkIfDone(elementName)
11 ++numberOfFiredLoadEvents;
13 if (numberOfFiredLoadEvents < expectedNumberOfFiredLoadEvents && elementName === 'body') {
14 log("FAIL Fired window Load event before link Load events.");
15 testFinished();
17 if (numberOfFiredLoadEvents === expectedNumberOfFiredLoadEvents) {
18 log("PASS Fired " + numberOfFiredLoadEvents + " Load events.");
19 testFinished();
22 </script>
23 <link rel="stylesheet" href="resources/stylesheet.css" onload="checkIfDone('link1')">
24 <link rel="stylesheet" href="resources/stylesheet.css" onload="checkIfDone('link2')">
25 </head>
26 <body onload="checkIfDone('body')">
27 <p>This tests that we fire two Load events on a page with two HTML Link elements and that both events are fired before the Load event for the window is dispatched. This test PASSED if you see the word PASS below. Otherwise, it FAILED.
28 <pre id="console"></pre>
29 </body>
30 </html>