blob: 5b0560b3172b4d8e4bd8dfe804ab581fce460749 [file] [log] [blame]
<!DOCTYPE html>
<title>classList: non-string contains</title>
<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#classes">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#domtokenlist">
<link rel="help" href="https://heycam.github.io/webidl/#es-DOMString">
<link rel="help" href="http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf#page=57">
<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>