<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
description("Tests that setting document.title does not reuse title's text node child");

var SVG_NAMESPACE = "http://www.w3.org/2000/svg";

var svgDocument = document.implementation.createDocument(SVG_NAMESPACE, "svg", null);
var title = svgDocument.createElementNS(SVG_NAMESPACE, "title");
title.textContent = "aaa";
svgDocument.documentElement.appendChild(title);

oldTextNode = svgDocument.getElementsByTagName("title")[0].firstChild;
shouldBeEqualToString("svgDocument.title", "aaa");
shouldBeEqualToString("oldTextNode.textContent", "aaa");
evalAndLog("svgDocument.title = 'bbb'");
shouldBeEqualToString("oldTextNode.textContent", "aaa");
newTextNode = svgDocument.getElementsByTagName("title")[0].firstChild;
shouldNotBe("oldTextNode", "newTextNode");
shouldBeEqualToString("svgDocument.title", "bbb");
shouldBeEqualToString("newTextNode.textContent", "bbb");
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
