chromium/third_party/blink/web_tests/svg/custom/multiple-title-elements.svg

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="400" height="300" viewBox="0 0 600 500"
     xmlns="http://www.w3.org/2000/svg" version="1.1" onload="test()">
<script>

var logOffset = 40;
var logOffsetIncrement = 40
function log(message)
{
    var t = document.createElementNS("http://www.w3.org/2000/svg", "text");
    t.appendChild(document.createTextNode(message));
    t.setAttribute('y', logOffset);
    t.setAttribute('x', 0);
    logOffset += logOffsetIncrement;
    document.getElementById("console").appendChild(t);
}

function expect(expected, actual)
{
    var msg = "Expected " + expected + ", got " + actual + ": ";
    if (expected == actual)
        log(msg + "PASS");
    else
        log(msg + "FAIL");
}

function createTitleElement(title)
{
    var t = document.createElementNS("http://www.w3.org/2000/svg", 'title');
    t.appendChild(document.createTextNode(title));
    return t;
}

function test()
{
    if (window.testRunner)
        testRunner.dumpAsText();

    expect('', document.title);
    document.documentElement.appendChild(createTitleElement('First title'));
    expect('First title', document.title);
    document.documentElement.appendChild(createTitleElement('Second title'));
    expect('First title', document.title);
    document.documentElement.removeChild(document.getElementsByTagName('title')[0]);
    expect('Second title', document.title);
}
</script>
<g id="console">
</g>
</svg>