jQuery.fn.after and jQuery.fn.before can break in document fragments

Description

jQuery.fn.after() and jQuery.fn.before() both make the assumption that this has a .parentNode. This is not always the case:

<body>
<div id="foo">
Bar
</div>
</body>

var testVar = $("#div").clone().after('<div>test</div>');

testVar should be expected to now contain $('<div id="foo">Bar</div><div>test</div>'), but because the cloned #div currently existing as a document fragment has no parentNode, you instead get TypeError: this.parentNode is null when attempting the after().