File tree Expand file tree Collapse file tree 2 files changed +5
-12
lines changed Expand file tree Collapse file tree 2 files changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -141,15 +141,15 @@ jQuery.fn.extend({
141
141
142
142
before : function ( ) {
143
143
return this . domManip ( arguments , false , function ( elem ) {
144
- if ( ! isDisconnected ( this ) ) {
144
+ if ( this . parentNode ) {
145
145
this . parentNode . insertBefore ( elem , this ) ;
146
146
}
147
147
} ) ;
148
148
} ,
149
149
150
150
after : function ( ) {
151
151
return this . domManip ( arguments , false , function ( elem ) {
152
- if ( ! isDisconnected ( this ) ) {
152
+ if ( this . parentNode ) {
153
153
this . parentNode . insertBefore ( elem , this . nextSibling ) ;
154
154
}
155
155
} ) ;
@@ -258,12 +258,11 @@ jQuery.fn.extend({
258
258
}
259
259
260
260
return this . domManip ( [ value ] , true , function ( elem ) {
261
- var next , parent ;
262
-
263
- if ( ! isDisconnected ( this ) && this . nodeType === 1 || this . nodeType === 11 ) {
264
- next = this . nextSibling ;
261
+ var next = this . nextSibling ,
265
262
parent = this . parentNode ;
266
263
264
+ if ( parent && this . nodeType === 1 || this . nodeType === 11 ) {
265
+
267
266
jQuery ( this ) . remove ( ) ;
268
267
269
268
if ( next ) {
Original file line number Diff line number Diff line change @@ -131,12 +131,6 @@ jQuery.fn.extend({
131
131
132
132
jQuery . fn . andSelf = jQuery . fn . addBack ;
133
133
134
- // A painfully simple check to see if an element is disconnected
135
- // from a document (should be improved, where feasible).
136
- function isDisconnected ( node ) {
137
- return ! node || ! node . parentNode || node . parentNode . nodeType === 11 ;
138
- }
139
-
140
134
function sibling ( cur , dir ) {
141
135
do {
142
136
cur = cur [ dir ] ;
You can’t perform that action at this time.
0 commit comments