blob: 1bf8528ac54ce9f8720da649372509d3527969c8 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test.js"></script>
<div id="root">
<div id="targetForSurround"></div>
<div id="description">Test that there is no crash when surroundContents is called with a node preceding the current selection.</div>
<div id="trailingNode"></div>
</div>
<script>
var range = document.createRange();
var rootNode = document.getElementById("root");
range.setStart(rootNode, 4);
range.setEnd(rootNode, 6);
var parentElement = document.getElementById("targetForSurround");
range.surroundContents(parentElement);
shouldBe('range.startContainer.id', 'rootNode.id');
shouldBe('range.startOffset', '3');
shouldBe('range.endContainer.id', 'rootNode.id');
shouldBe('range.startOffset', '3');
</script>
</body>
</html>