Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<meta charset=utf-8>
<title>DOMTokenList stringifier</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>
<span class=" a a b "></span>
<script>
test(function() {
assert_equals(String(document.createElement("span").classList), "",
"String(classList) should return the empty list for an undefined class attribute");
var span = document.querySelector("span");
assert_equals(span.getAttribute("class"), " a a b ",
"getAttribute should return the literal value");
assert_equals(span.className, " a a b ",
"className should return the literal value");
assert_equals(String(span.classList), " a a b ",
"String(classList) should return the literal value");
assert_equals(span.classList.toString(), " a a b ",
"classList.toString() should return the literal value");
assert_class_string(span.classList, "DOMTokenList");
});
</script>