summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/lists/DOMTokenList-stringifier.html
blob: b125388e02bac68d576b308e409db2dd8fb72112 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<meta charset=utf-8>
<title>DOMTokenList stringifier</title>
<link rel=help href="https://dom.spec.whatwg.org/#dom-domtokenlist-stringifier">
<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>