File: getElementsByClassName-whitespace-class-names.html

package info (click to toggle)
firefox 144.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,637,504 kB
  • sloc: cpp: 7,576,692; javascript: 6,430,831; ansic: 3,748,119; python: 1,398,978; xml: 628,810; asm: 438,679; java: 186,194; sh: 63,212; makefile: 19,159; objc: 13,086; perl: 12,986; yacc: 4,583; cs: 3,846; pascal: 3,448; lex: 1,720; ruby: 1,003; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 53; csh: 10
file content (50 lines) | stat: -rw-r--r-- 2,019 bytes parent folder | download | duplicates (26)
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="&#x000B;">LINE TABULATION</span>
<span class="&#x0085;">NEXT LINE</span>
<span class="&#x00A0;">NO-BREAK SPACE</span>
<span class="&#x1680;">OGHAM SPACE MARK</span>
<span class="&#x2000;">EN QUAD</span>
<span class="&#x2001;">EM QUAD</span>
<span class="&#x2002;">EN SPACE</span>
<span class="&#x2003;">EM SPACE</span>
<span class="&#x2004;">THREE-PER-EM SPACE</span>
<span class="&#x2005;">FOUR-PER-EM SPACE</span>
<span class="&#x2006;">SIX-PER-EM SPACE</span>
<span class="&#x2007;">FIGURE SPACE</span>
<span class="&#x2008;">PUNCTUATION SPACE</span>
<span class="&#x2009;">THIN SPACE</span>
<span class="&#x200A;">HAIR SPACE</span>
<span class="&#x2028;">LINE SEPARATOR</span>
<span class="&#x2029;">PARAGRAPH SEPARATOR</span>
<span class="&#x202F;">NARROW NO-BREAK SPACE</span>
<span class="&#x205F;">MEDIUM MATHEMATICAL SPACE</span>
<span class="&#x3000;">IDEOGRAPHIC SPACE</span>

<span class="&#x180E;">MONGOLIAN VOWEL SEPARATOR</span>
<span class="&#x200B;">ZERO WIDTH SPACE</span>
<span class="&#x200C;">ZERO WIDTH NON-JOINER</span>
<span class="&#x200D;">ZERO WIDTH JOINER</span>
<span class="&#x2060;">WORD JOINER</span>
<span class="&#xFEFF;">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>