DOMTokenList-value.html (1095B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>DOMTokenList value</title> 4 <link rel=help href="https://dom.spec.whatwg.org/#dom-domtokenlist-value"> 5 <link rel=author title=Tangresh href="mailto:dmenzi@tangresh.ch"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <span class=" a a b "></span> 9 <script> 10 test(function() { 11 assert_equals(String(document.createElement("span").classList.value), "", 12 "classList.value should return the empty list for an undefined class attribute"); 13 var span = document.querySelector("span"); 14 assert_equals(span.classList.value, " a a b ", 15 "value should return the literal value"); 16 span.classList.value = " foo bar foo "; 17 assert_equals(span.classList.value, " foo bar foo ", 18 "assigning value should set the literal value"); 19 assert_equals(span.classList.length, 2, 20 "length should be the number of tokens"); 21 assert_class_string(span.classList, "DOMTokenList"); 22 assert_class_string(span.classList.value, "String"); 23 }); 24 </script>