blob: 59bfd2e6b1c0999a4bb1029ea0978315c10acaa9 (
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
|
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>Node.prototype.getElementsByClassName with no real class names</title>
<link rel=help href="https://dom.spec.whatwg.org/#dom-document-getelementsbyclassname">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<span class="">LINE TABULATION</span>
<span class="…">NEXT LINE</span>
<span class=" ">NO-BREAK SPACE</span>
<span class=" ">OGHAM SPACE MARK</span>
<span class=" ">EN QUAD</span>
<span class=" ">EM QUAD</span>
<span class=" ">EN SPACE</span>
<span class=" ">EM SPACE</span>
<span class=" ">THREE-PER-EM SPACE</span>
<span class=" ">FOUR-PER-EM SPACE</span>
<span class=" ">SIX-PER-EM SPACE</span>
<span class=" ">FIGURE SPACE</span>
<span class=" ">PUNCTUATION SPACE</span>
<span class=" ">THIN SPACE</span>
<span class=" ">HAIR SPACE</span>
<span class="
">LINE SEPARATOR</span>
<span class="
">PARAGRAPH SEPARATOR</span>
<span class=" ">NARROW NO-BREAK SPACE</span>
<span class=" ">MEDIUM MATHEMATICAL SPACE</span>
<span class=" ">IDEOGRAPHIC SPACE</span>
<span class="᠎">MONGOLIAN VOWEL SEPARATOR</span>
<span class="​">ZERO WIDTH SPACE</span>
<span class="‌">ZERO WIDTH NON-JOINER</span>
<span class="‍">ZERO WIDTH JOINER</span>
<span class="⁠">WORD JOINER</span>
<span class="">ZERO WIDTH NON-BREAKING SPACE</span>
<script>
"use strict";
const spans = document.querySelectorAll("span");
for (const span of spans) {
test(() => {
const className = span.getAttribute("class");
assert_equals(className.length, 1, "Sanity check: the class name was retrieved and is a single character");
const shouldBeSpan = document.getElementsByClassName(className);
assert_array_equals(shouldBeSpan, [span]);
}, `Passing a ${span.textContent} to getElementsByClassName still finds the span`);
}
</script>
|