area-download-click.html (1275B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Clicking on an <area> element with a download attribute must not throw an exception</title> 4 <link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me"> 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-area-element:activation-behaviour"> 6 <link rel="help" href="https://github.com/whatwg/html/issues/2116"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <body> 10 <script> 11 "use strict"; 12 async_test(t => { 13 const frame = document.createElement("iframe"); 14 15 frame.addEventListener("load", t.step_func(function () { 16 frame.contentWindow.addEventListener( 17 "beforeunload", t.unreached_func("Navigated instead of downloading")); 18 const string = "test"; 19 const blob = new Blob([string], { type: "text/html" }); 20 21 const link = frame.contentDocument.querySelector("#blob-url"); 22 link.href = URL.createObjectURL(blob); 23 24 link.click(); 25 26 t.step_timeout(() => t.done(), 1000); 27 })); 28 frame.src = "resources/area-download-click.html"; 29 document.body.appendChild(frame); 30 }, "Clicking on an <area> element with a download attribute must not throw an exception"); 31 </script> 32 </body>