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

by ndobrynin

HTML

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"> </script>
</head>
<body>

<!--
    Ticket #12799 (jQuery): 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
-->
<p>Hello</p>

<script>
jQuery("p").replaceWith( "<b>Paragraph. </b>" );
</script>

</body>
</html>