replaceWith fails when MIME is application/xhtml+xml

Note that the bug does not show on jsfiddle since there is no way to change the MIME type of the HTML content to application/xhtml+xml : https://github.com/jsfiddle/jsfiddle-docs-alpha/issues/29

HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<body>
 
<button>First</button>
<button>Second</button>
<button>Third</button>
 
<script>
$("button").click(function () {
  $(this).replaceWith( "<div>" + $(this).text() + "</div>" );
});
</script>
    </body>
</html>

CSS

button { display:block; margin:3px; color:red; width:200px; }
  div { color:red; border:2px solid blue; width:200px;
      margin:3px; text-align:center; }