Skip to content

Commit

Permalink
Bug 1597354 [wpt PR 20301] - Test for link element firing multiple ev…
Browse files Browse the repository at this point in the history
…ents, a=testonly

Automatic update from web-platform-tests
Test for link element firing multiple events (#20301)

--

wpt-commits: ee893908a206f562a35f202fce67e667bc19f603
wpt-pr: 20301
  • Loading branch information
domfarolino authored and moz-wptsync-bot committed Nov 29, 2019
1 parent ce22ef5 commit 54a335c
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<link rel="author" title="Dom Farolino" href="mailto:dom@chromium.org">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-link-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link id=style_link rel=stylesheet>
<script>
async_test(t => {
const link = document.querySelector('#style_link');
link.onload = t.unreached_func('Sheet should fail to load');
link.onerror = t.step_func(() => {
link.onerror = t.step_func_done(() => {});
link.href = 'nonexistent.css?second';
});

link.href = 'nonexistent.css?first';
}, "Check if the <link>'s error event fires for each stylesheet it fails to load");

</script>
</head>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<link rel="author" title="Dom Farolino" href="mailto:dom@chromium.org">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-link-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link id=style_link rel=stylesheet>
<script>
async_test(t => {
const link = document.querySelector('#style_link');
link.onerror = t.unreached_func('Sheet should load successfully');
link.onload = t.step_func(() => {
link.onload = t.step_func_done(() => {});
link.href = 'style.css?second';
});

link.href = 'style.css?first';

}, "Check if the <link>'s load event fires for each stylesheet it loads");
</script>
</head>
</html>

0 comments on commit 54a335c

Please sign in to comment.