<p>
    Test for <i><a href="rdar://problem/6074587">rdar://problem/6074587</a>
    REGRESSION (34722): Unable to view AT&amp;T wireless bill - window title contains markup, window is empty</i>.
</p>
<pre id="console"></pre>
<script>
    if (window.testRunner)
        testRunner.dumpAsText();

    function log(message)
    {
        document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
    }

    function testTitle(text, expected)
    {
        var doc = document.implementation.createHTMLDocument();
        doc.open();
        doc.write("<title>" + text + "</title>text</title>");

        var actual = doc.getElementsByTagName("title")[0].firstChild.data;
        if (actual == expected)
            log("PASS: " + text + " parsed correctly");
        else
            log("FAIL: " + text + " parsed into " + actual + " instead of " + expected);
    }

    testTitle("foo&lt;/title>bar", "foo</title>bar");
    testTitle("foo&", "foo&");
    testTitle("foo&bar", "foo&bar");

    testTitle("&lt;/title>bar", "</title>bar");
    testTitle("&", "&");
    testTitle("&bar", "&bar");
</script>
