<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://dom.spec.whatwg.org/#dom-range-detach">
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<div id="div" contenteditable="true">test<a href="http://www.google.com/" id="testLink">link</a></div>
<script>
description("Tests that Range.detach() is a no-op.");
function checkInvariance() {
shouldBe("range.startContainer", "link");
shouldBe("range.startOffset", "0");
shouldBe("range.endContainer", "link");
shouldBe("range.endOffset", "0");
shouldBeTrue("range.collapsed");
shouldBe("range.commonAncestorContainer", "link");
}
var range = new Range();
var link = document.getElementById("testLink");
range.setStart(link, 0);
range.setEnd(link, 0);
checkInvariance();
shouldNotThrow("range.detach()");
checkInvariance();
</script>
</body>
</html>