Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<title>classList: non-string contains</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">
<ul>
<li class=undefined>
<li class=null>
<li class=0>
<li class=NaN>
<li class=Infinity>
<li class=-Infinity>
</ul>
<script>
var items = document.getElementById("test")
.getElementsByTagName("li");
var tests = [undefined, null, -0, +0, NaN, +Infinity, -Infinity];
var results = [
[true, false, false, false, false, false, false], // "undefined"
[false, true, false, false, false, false, false], // "null"
[false, false, true, true, false, false, false], // "0"
[false, false, false, false, true, false, false], // "NaN"
[false, false, false, false, false, true, false], // "Infinity"
[false, false, false, false, false, false, true ] // "-Infinity"
];
</script>
</div>
<script>
test(function() {
for (var i = 0, il = items.length; i < il; ++i) {
test(function() {
for (var j = 0, jl = tests.length; j < jl; ++j) {
assert_equals(items[i].classList.contains(tests[j]), results[i][j]);
}
})
}
})
</script>