title.text-02.xhtml (937B)
1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <head> 3 <title>title.text with comment and element children.</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 try { 13 var title = document.getElementsByTagName("title")[0]; 14 while (title.childNodes.length) 15 title.removeChild(title.childNodes[0]); 16 title.appendChild(document.createComment("COMMENT")); 17 title.appendChild(document.createTextNode("TEXT")); 18 title.appendChild(document.createElement("a")) 19 .appendChild(document.createTextNode("ELEMENT")) 20 } catch (e) { 21 } 22 </script> 23 <script> 24 test(function() { 25 assert_equals(title.text, "TEXT"); 26 assert_equals(title.textContent, "TEXTELEMENT"); 27 }) 28 </script> 29 </body> 30 </html>