<html>
<head>
<style>
span { display: inline-block; font-family: monospace; }
</style>
<script>
function test()
{
   var s2 = document.getElementById("s2");
   var s3 = document.createElement("span");
   s3.innerHTML = "Details3";
   var parent = s2.parentNode;
   parent.replaceChild(s3, s2);
}

function runTest()
{
    if (window.testRunner)
        document.getElementById("run").click();
}
</script>
<body onload="runTest()">
<details open>
  <summary>
    <span id="s1">Details1</span>
    <span id="s2">Details2</span>
  </summary>
</details>
<input id="run" type="button" value="click" onclick="test()">
</body>
</html>
