clone-contents-0-end-offset.html   [plain text]


<!-- This test was derived from a real case inside the Mail application, bug 3812471.-->

<blockquote id="start"><span id="end">Heck, son, you're a failure</span></blockquote>

<p>The result appears below here; should not include any text:</p>

<p id="destination">Original text, should not be seen.</p>

<script>

var start = document.getElementById("start");
var end = document.getElementById("end");
var destination = document.getElementById("destination");

var r = document.createRange();
r.setStart(start, 0);
r.setEnd(end, 0);

while (destination.firstChild)
    destination.removeChild(destination.firstChild);
destination.appendChild(r.cloneContents());

</script>