diff options
Diffstat (limited to 'testing/web-platform/tests/dom/nodes/getElementsByClassName-whitespace-class-names.html')
-rw-r--r-- | testing/web-platform/tests/dom/nodes/getElementsByClassName-whitespace-class-names.html | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/testing/web-platform/tests/dom/nodes/getElementsByClassName-whitespace-class-names.html b/testing/web-platform/tests/dom/nodes/getElementsByClassName-whitespace-class-names.html new file mode 100644 index 0000000000..59bfd2e6b1 --- /dev/null +++ b/testing/web-platform/tests/dom/nodes/getElementsByClassName-whitespace-class-names.html @@ -0,0 +1,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> |