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