|
1 | 1 | <!DOCTYPE html> |
| 2 | +<meta name="viewport" content="width=device-width"> |
2 | 3 | <style> |
3 | 4 | a { |
4 | | - -webkit-clip-path: path("M 82 14 L 86 14 L 86 18 L 82 18 z"); |
| 5 | + -webkit-clip-path: path("M 82 14 L 84 14 L 84 16 L 82 16 z"); |
| 6 | + text-decoration: none; |
5 | 7 | } |
6 | 8 | img { |
7 | 9 | width: 100px; |
|
10 | 12 | </style> |
11 | 13 | <script> |
12 | 14 | window.addEventListener("load", () => { |
13 | | - if (!window.internals) |
14 | | - return; |
15 | | - |
16 | | - const link = document.querySelector("a"); |
17 | | - link.rel = internals.systemPreviewRelType(); |
| 15 | + const canvas = document.createElement("canvas"); |
| 16 | + canvas.width = 10; |
| 17 | + canvas.height = 10; |
| 18 | + const ctx = canvas.getContext("2d"); |
| 19 | + const images = document.querySelectorAll("img"); |
| 20 | + images.forEach(image => { |
| 21 | + ctx.clearRect(0, 0, 10, 10); |
| 22 | + const color = image.getAttribute("data-color"); |
| 23 | + ctx.fillStyle = color; |
| 24 | + ctx.fillRect(0, 0, 10, 10); |
| 25 | + image.src = canvas.toDataURL(); |
| 26 | + }); |
18 | 27 | }, false); |
19 | 28 | </script> |
20 | | -<p>This test only works in WKTR or DRT.</p> |
21 | | -<a href="/"> |
22 | | - <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAABlBMVEUAAP8AAAB7Yr8+AAAAEElEQVR4nGJgBQAAAP//AwAABwAGzHKrJgAAAABJRU5ErkJggg=="> |
| 29 | +<a href="/" rel="ar"> |
| 30 | + <img data-color="red"> |
| 31 | +</a> |
| 32 | +<a href="/" rel="ar"> |
| 33 | + <img data-color="green"> |
| 34 | +</a> |
| 35 | +<a href="/" rel="ar"> |
| 36 | + <img data-color="blue"> |
| 37 | +</a> |
| 38 | +<a href="/" rel="ar"> |
| 39 | + <img data-color="cyan"> |
| 40 | +</a> |
| 41 | +<a href="/" rel="ar"> |
| 42 | + <img data-color="#777777"> |
| 43 | +</a> |
| 44 | +<a href="/" rel="ar"> |
| 45 | + <img data-color="rgba(255, 128, 0, 0.5)"> |
| 46 | +</a> |
| 47 | +<a href="/" rel="ar"> |
| 48 | + <img data-color="white"> |
| 49 | +</a> |
| 50 | +<a href="/" rel="ar"> |
| 51 | + <img data-color="black"> |
| 52 | +</a> |
| 53 | +<a href="/" rel="ar"> |
| 54 | + <img data-color="rgba(0, 0, 0, 0.0)"> |
23 | 55 | </a> |
0 commit comments