title.text-03.html (1309B)
1 <!DOCTYPE html> 2 <title> title.text and space normalization </title> 3 <link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"> 4 <link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-title-text"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <div id="log"></div> 8 <script> 9 test(function() { 10 assert_equals(document.getElementsByTagName("title")[0].text, 11 " title.text and space normalization "); 12 assert_equals(document.getElementsByTagName("title")[0].textContent, 13 " title.text and space normalization "); 14 assert_equals(document.getElementsByTagName("title")[0].firstChild.nodeValue, 15 " title.text and space normalization "); 16 }, "title.text and space normalization (markup)"); 17 [ 18 "one space", "two spaces", 19 "one\ttab", "two\t\ttabs", 20 "one\nnewline", "two\n\nnewlines", 21 "one\fform feed", "two\f\fform feeds", 22 "one\rcarriage return", "two\r\rcarriage returns" 23 ].forEach(function(str) { 24 test(function() { 25 document.title = str; 26 var title = document.getElementsByTagName("title")[0]; 27 assert_equals(title.text, str); 28 assert_equals(title.textContent, str); 29 assert_equals(title.firstChild.nodeValue, str); 30 }, "title.text and space normalization: " + format_value(str)) 31 }); 32 </script>