Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/dom/documents/dom-tree-accessors/Element.getElementsByClassName-null-undef.html - WPT Dashboard Interop Dashboard
<!doctype html>
<title>getElementsByClassName and null/undefined</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<div id="test">
<p id="p1"></p>
<p class="undefined" id="p2"></p>
<p class="null" id="p3"></p>
<p class="undefined null" id="p4"></p>
</div>
<script>
test(function() {
var wrapper = document.getElementById("test");
assert_equals(wrapper.getElementsByClassName(undefined).length, 2);
assert_equals(wrapper.getElementsByClassName(undefined)[0],
document.getElementById("p2"));
assert_equals(wrapper.getElementsByClassName(undefined)[1],
document.getElementById("p4"));
/*
assert_equals(wrapper.getElementsByClassName(null).length, 2);
assert_equals(wrapper.getElementsByClassName(null)[0],
document.getElementById("p3"));
assert_equals(wrapper.getElementsByClassName(null)[1],
document.getElementById("p4"));
*/
});
</script>