summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/embedded-content/the-img-element/usemap-casing.html
blob: c28f667ff3ae310ecd45b3be9c8cf0cb972a2722 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html>
<meta charset=utf-8>
<title>img usemap case-sensitive</title>
<link rel="author" title="Domenic Denicola" href="mailto:d@domenic.me">
<link rel="help" href="https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-a-hash-name-reference">
<!-- See also: https://github.com/whatwg/html/issues/1666 -->

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<img src="/images/threecolors.png" usemap="#sanityCheck" width="100" height="100">
<map name="sanityCheck"><area shape="rect" coords="0,0,100,100"></map>

<img src="/images/threecolors.png" usemap="#sImPlE" width="100" height="100">
<map name="simple"><area shape="rect" coords="0,0,100,100"></map>
<map name="SIMPLE"><area shape="rect" coords="0,0,100,100"></map>

<img src="/images/threecolors.png" usemap="#paSSfield-killroyß" width="100" height="100">
<map name="passfield-killroyß"><area shape="rect" coords="0,0,100,100"></map>
<map name="PASSFIELD-KILLROYß"><area shape="rect" coords="0,0,100,100"></map>
<map name="paſſfield-killroyß"><area shape="rect" coords="0,0,100,100"></map>
<map name="passfield-&#x212a;illroyß"><area shape="rect" coords="0,0,100,100"></map>
<map name="paßfield-killroyß"><area shape="rect" coords="0,0,100,100"></map>
<map name="paẞfield-killroyß"><area shape="rect" coords="0,0,100,100"></map>
<map name="passfield-killroyẞ"><area shape="rect" coords="0,0,100,100"></map>
<map name="passfield-killroyß"><area shape="rect" coords="0,0,100,100"></map>
<map name="passfıeld-killroyß"><area shape="rect" coords="0,0,100,100"></map>
<map name="passfİeld-killroyß"><area shape="rect" coords="0,0,100,100"></map>

<img src="/images/threecolors.png" usemap="#глупый" width="100" height="100">
<map name="глупы&#x438;&#x306;"><area shape="rect" coords="0,0,100,100"></map>
<map name="ГЛУПЫЙ"><area shape="rect" coords="0,0,100,100"></map>
<map name="ГЛУПЫ&#x418;&#x306;"><area shape="rect" coords="0,0,100,100"></map>

<img src="/images/threecolors.png" usemap="#åωk" width="100" height="100">
<map name="ÅΩK"><area shape="rect" coords="0,0,100,100"></map>
<map name="&#x212b;ωk"><area shape="rect" coords="0,0,100,100"></map>
<map name="å&#x2126;k"><area shape="rect" coords="0,0,100,100"></map>
<map name="åω&#x212a;"><area shape="rect" coords="0,0,100,100"></map>

<img src="/images/threecolors.png" usemap="#blah1" width="100" height="100">
<map name="blah&#x2460;"><area shape="rect" coords="0,0,100,100"></map>
<map name="bl&#x24b6;h1"><area shape="rect" coords="0,0,100,100"></map>
<map name="bl&#x24d0;h1"><area shape="rect" coords="0,0,100,100"></map>

<img src="/images/threecolors.png" usemap="#t&Eacute;dz5アパートFi" width="100" height="100">
<map name="T&Eacute;DZ5アパートFi"><area shape="rect" coords="0,0,100,100"></map>
<map name="T&eacute;&#x01F1;&#x2075;アパートFi"><area shape="rect" coords="0,0,100,100"></map>
<map name="t&Eacute;dz5&#x3100;Fi"><area shape="rect" coords="0,0,100,100"></map>
<map name="t&Eacute;dz5&#x30A2;&#x30CF;&#x309A;&#x30FC;&#x30C8;Fi"><area shape="rect" coords="0,0,100,100"></map>
<map name="T&Eacute;DZ⁵アパートFi"><area shape="rect" coords="0,0,100,100"></map>
<map name="T&Eacute;DZ5アパートfi"><area shape="rect" coords="0,0,100,100"></map>

<img src="/images/threecolors.png" usemap="#ΣΣ" width="100" height="100">
<map name="σς"><area shape="rect" coords="0,0,100,100"></map>

<div id="log"></div>

<script>
"use strict";
setup({ explicit_done: true });

onload = () => {
  test(() => {
    const image = document.querySelector(`img[usemap="#sanityCheck"]`);
    const imageRect = image.getBoundingClientRect();
    const x = imageRect.left + imageRect.width / 2;
    const y = imageRect.top + imageRect.height / 2;
    const element = document.elementFromPoint(x, y);
    const area = document.querySelector(`map[name="sanityCheck"] > area`);

    assert_equals(element, area);
  }, `Image with usemap of #sanityCheck should match the area with map named sanityCheck`);

  const images = Array.from(document.querySelectorAll(`img:not([usemap="#sanityCheck"])`));

  for (let image of images) {
    test(() => {
      const imageRect = image.getBoundingClientRect();
      const x = imageRect.left + imageRect.width / 2;
      const y = imageRect.top + imageRect.height / 2;
      const element = document.elementFromPoint(x, y);

      const name = element.parentElement.getAttribute("name");
      const messageSuffix = name ? `; used <map> with name "${name}"` : "";

      assert_equals(element, image, "The element retrieved must be the image, not an area" + messageSuffix);
    }, `Image with usemap of ${image.useMap} should not match any of the areas`);
  }

  done();
};
</script>