getElementsByClassName-empty-set.html (981B)
1 <!DOCTYPE html> 2 <html> 3 <meta charset="utf-8"> 4 <title>Node.prototype.getElementsByClassName with no real class names</title> 5 <link rel=help href="https://dom.spec.whatwg.org/#dom-document-getelementsbyclassname"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 9 <span class=" ">test</span> 10 11 <script> 12 "use strict"; 13 14 test(() => { 15 const elements = document.getElementsByClassName(""); 16 assert_array_equals(elements, []); 17 }, "Passing an empty string to getElementsByClassName should return an empty HTMLCollection"); 18 19 test(() => { 20 const elements = document.getElementsByClassName(" "); 21 assert_array_equals(elements, []); 22 }, "Passing a space to getElementsByClassName should return an empty HTMLCollection"); 23 24 test(() => { 25 const elements = document.getElementsByClassName(" "); 26 assert_array_equals(elements, []); 27 }, "Passing three spaces to getElementsByClassName should return an empty HTMLCollection"); 28 29 </script>