blob: 41f9218bcc7c4b8178eefa994c59cb124eb68303 [file] [log] [blame]
<html>
<head>
<script>
function startTest() {
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.dumpAsText();
testRunner.dumpTitleChanges();
}
console.log("Setting document.title to TITLE1");
document.title = 'TITLE1';
internals.queueTask("DOMManipulation", () => continueTest());
}
function continueTest() {
title = document.getElementsByTagName('title').item(0);
console.log("Setting title element's text to TITLE2");
title.text = 'TITLE2';
internals.queueTask("DOMManipulation", () => endTest());
}
function endTest() {
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);
}
internals.queueTask("DOMManipulation", () => testRunner.notifyDone());
}
</script>
<title>Initial title</title>
</head>
<body onload="startTest();" >
</body>
</html>