-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests that <a>/<area> can be downloaded without user interaction
That is, that calling .click() does not throw at least, as it used to per-spec. Matches the HTML change at whatwg/html#2136 per the HTML bug report at whatwg/html#2116.
- Loading branch information
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
html/semantics/embedded-content/the-area-element/area-download-click.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Clicking on an <area> element with a download attribute must not throw an exception</title> | ||
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-area-element:activation-behaviour"> | ||
<link rel="help" href="https://github.com/whatwg/html/issues/2116"> | ||
|
||
<img src="/images/threecolors.png" usemap="#x" id="img" width="300" height="300"> | ||
<map name="x"> | ||
<area id="blob-url" download="foo.html" coords="0,0,300,300"> | ||
</map> | ||
|
||
<script> | ||
"use strict"; | ||
|
||
const string = "test"; | ||
const blob = new Blob([string], { type: "text/html" }); | ||
|
||
const link = document.querySelector("#blob-url"); | ||
link.href = URL.createObjectURL(blob); | ||
|
||
link.click(); | ||
</script> |
20 changes: 20 additions & 0 deletions
20
html/semantics/text-level-semantics/the-a-element/a-download-click.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Clicking on an <a> element with a download attribute must not throw an exception</title> | ||
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-a-element:activation-behaviour"> | ||
<link rel="help" href="https://github.com/whatwg/html/issues/2116"> | ||
|
||
<a id="blob-url" download="foo.html">Click me</a> | ||
|
||
<script> | ||
"use strict"; | ||
|
||
const string = "test"; | ||
const blob = new Blob([string], { type: "text/html" }); | ||
|
||
const link = document.querySelector("#blob-url"); | ||
link.href = URL.createObjectURL(blob); | ||
|
||
link.click(); | ||
</script> |