before: function() {
return this.domManip( arguments, false, function( elem ) {
- if ( !isDisconnected( this ) ) {
+ if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this );
}
});
after: function() {
return this.domManip( arguments, false, function( elem ) {
- if ( !isDisconnected( this ) ) {
+ if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this.nextSibling );
}
});
}
return this.domManip( [ value ], true, function( elem ) {
- var next, parent;
-
- if ( !isDisconnected( this ) && this.nodeType === 1 || this.nodeType === 11 ) {
- next = this.nextSibling;
+ var next = this.nextSibling,
parent = this.parentNode;
+ if ( parent && this.nodeType === 1 || this.nodeType === 11 ) {
+
jQuery( this ).remove();
if ( next ) {
jQuery.fn.andSelf = jQuery.fn.addBack;
-// A painfully simple check to see if an element is disconnected
-// from a document (should be improved, where feasible).
-function isDisconnected( node ) {
- return !node || !node.parentNode || node.parentNode.nodeType === 11;
-}
-
function sibling( cur, dir ) {
do {
cur = cur[ dir ];