| <html> |
| <head> |
| <script> |
| function runTests() { |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.dumpTitleChanges(); |
| } |
| |
| console.log("Setting document.title to TITLE1"); |
| document.title = 'TITLE1'; |
| |
| title = document.getElementsByTagName('title').item(0); |
| |
| console.log("Setting title element's text to TITLE2"); |
| title.text = 'TITLE2'; |
| |
| newTitle = document.createElement('title'); |
| console.log("Should not set title"); |
| newTitle.appendChild(document.createTextNode('FAIL')); |
| |
| document.getElementsByTagName('head').item(0).appendChild(newTitle); |
| |
| // Remove both title elements |
| console.log("Should reset title to the empty string"); |
| titleElements = document.getElementsByTagName('title'); |
| while (titleElements.length) { |
| titleElement = titleElements[titleElements.length - 1]; |
| titleElement.parentNode.removeChild(titleElement); |
| } |
| } |
| </script> |
| <title>Initial title</title> |
| </head> |
| <body onload="runTests();" > |
| </body> |
| </html> |