<!DOCTYPE html>
<html>
<body>
<script src="../../resources/dump-as-markup.js"></script>
<div id="div" contenteditable="true">dog<a href="http://www.google.com/">food</a></div>
<script>

Markup.description("This tests for a bug in GMail's Editor, they try to extract the contents of a range that has had it's contents removed from the document by an editing command.  Since the bug 43017 requires WebKit does not remove anchor elements, div should be empty after the extraction. We currently leave anchor element in the div due to the Bug 47916.");

var div = document.getElementById("div");
var text = div.firstChild;
var link = div.lastChild;
div.focus();

var r = document.createRange();
r.setStart(text, 0);
r.setEnd(link, link.childNodes.length);

document.execCommand("SelectAll");
document.execCommand("RemoveFormat");

Markup.dump(div, 'After removeFormat');

r.extractContents();

Markup.dump(div, 'After extractContents()');

</script>
</body>
</html>
