Strange behavior of jQuery.replaceWith and jQuery.html when executed using the body selector. You will lose the body tag after calling:
$('body').replaceWith('<body>New body</body>');
This does not happen with any other selector, like:
$('title').replaceWith('<title>New title</title>');
Also jQuery.html does not double the body tag (like other tags) and works like replaceWith when called like this:
$('body').html('<body>New body</body>');
Hope this is not a jQuery gray zone. Or, if so, they do not think to correct it. I have applications in which I use $ ('body'). Html when $ ('body'). ReplaceWith should be used.
Ekrem ΓzgΓΌr
source share