| @@ 5922-5989 (lines=68) @@ | ||
| 5919 | return this.remove( selector, true ); |
|
| 5920 | }, |
|
| 5921 | ||
| 5922 | domManip: function( args, table, callback ) { |
|
| 5923 | var results, first, fragment, parent, |
|
| 5924 | value = args[0], |
|
| 5925 | scripts = []; |
|
| 5926 | ||
| 5927 | // We can't cloneNode fragments that contain checked, in WebKit |
|
| 5928 | if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) { |
|
| 5929 | return this.each(function() { |
|
| 5930 | jQuery(this).domManip( args, table, callback, true ); |
|
| 5931 | }); |
|
| 5932 | } |
|
| 5933 | ||
| 5934 | if ( jQuery.isFunction(value) ) { |
|
| 5935 | return this.each(function(i) { |
|
| 5936 | var self = jQuery(this); |
|
| 5937 | args[0] = value.call(this, i, table ? self.html() : undefined); |
|
| 5938 | self.domManip( args, table, callback ); |
|
| 5939 | }); |
|
| 5940 | } |
|
| 5941 | ||
| 5942 | if ( this[0] ) { |
|
| 5943 | parent = value && value.parentNode; |
|
| 5944 | ||
| 5945 | // If we're in a fragment, just use that instead of building a new one |
|
| 5946 | if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) { |
|
| 5947 | results = { fragment: parent }; |
|
| 5948 | ||
| 5949 | } else { |
|
| 5950 | results = jQuery.buildFragment( args, this, scripts ); |
|
| 5951 | } |
|
| 5952 | ||
| 5953 | fragment = results.fragment; |
|
| 5954 | ||
| 5955 | if ( fragment.childNodes.length === 1 ) { |
|
| 5956 | first = fragment = fragment.firstChild; |
|
| 5957 | } else { |
|
| 5958 | first = fragment.firstChild; |
|
| 5959 | } |
|
| 5960 | ||
| 5961 | if ( first ) { |
|
| 5962 | table = table && jQuery.nodeName( first, "tr" ); |
|
| 5963 | ||
| 5964 | for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) { |
|
| 5965 | callback.call( |
|
| 5966 | table ? |
|
| 5967 | root(this[i], first) : |
|
| 5968 | this[i], |
|
| 5969 | // Make sure that we do not leak memory by inadvertently discarding |
|
| 5970 | // the original fragment (which might have attached data) instead of |
|
| 5971 | // using it; in addition, use the original fragment object for the last |
|
| 5972 | // item instead of first because it can end up being emptied incorrectly |
|
| 5973 | // in certain situations (Bug #8070). |
|
| 5974 | // Fragments from the fragment cache must always be cloned and never used |
|
| 5975 | // in place. |
|
| 5976 | results.cacheable || ( l > 1 && i < lastIndex ) ? |
|
| 5977 | jQuery.clone( fragment, true, true ) : |
|
| 5978 | fragment |
|
| 5979 | ); |
|
| 5980 | } |
|
| 5981 | } |
|
| 5982 | ||
| 5983 | if ( scripts.length ) { |
|
| 5984 | jQuery.each( scripts, evalScript ); |
|
| 5985 | } |
|
| 5986 | } |
|
| 5987 | ||
| 5988 | return this; |
|
| 5989 | } |
|
| 5990 | }); |
|
| 5991 | ||
| 5992 | function root( elem, cur ) { |
|
| @@ 5224-5291 (lines=68) @@ | ||
| 5221 | return this.remove( selector, true ); |
|
| 5222 | }, |
|
| 5223 | ||
| 5224 | domManip: function( args, table, callback ) { |
|
| 5225 | var results, first, fragment, parent, |
|
| 5226 | value = args[0], |
|
| 5227 | scripts = []; |
|
| 5228 | ||
| 5229 | // We can't cloneNode fragments that contain checked, in WebKit |
|
| 5230 | if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) { |
|
| 5231 | return this.each(function() { |
|
| 5232 | jQuery(this).domManip( args, table, callback, true ); |
|
| 5233 | }); |
|
| 5234 | } |
|
| 5235 | ||
| 5236 | if ( jQuery.isFunction(value) ) { |
|
| 5237 | return this.each(function(i) { |
|
| 5238 | var self = jQuery(this); |
|
| 5239 | args[0] = value.call(this, i, table ? self.html() : undefined); |
|
| 5240 | self.domManip( args, table, callback ); |
|
| 5241 | }); |
|
| 5242 | } |
|
| 5243 | ||
| 5244 | if ( this[0] ) { |
|
| 5245 | parent = value && value.parentNode; |
|
| 5246 | ||
| 5247 | // If we're in a fragment, just use that instead of building a new one |
|
| 5248 | if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) { |
|
| 5249 | results = { fragment: parent }; |
|
| 5250 | ||
| 5251 | } else { |
|
| 5252 | results = jQuery.buildFragment( args, this, scripts ); |
|
| 5253 | } |
|
| 5254 | ||
| 5255 | fragment = results.fragment; |
|
| 5256 | ||
| 5257 | if ( fragment.childNodes.length === 1 ) { |
|
| 5258 | first = fragment = fragment.firstChild; |
|
| 5259 | } else { |
|
| 5260 | first = fragment.firstChild; |
|
| 5261 | } |
|
| 5262 | ||
| 5263 | if ( first ) { |
|
| 5264 | table = table && jQuery.nodeName( first, "tr" ); |
|
| 5265 | ||
| 5266 | for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) { |
|
| 5267 | callback.call( |
|
| 5268 | table ? |
|
| 5269 | root(this[i], first) : |
|
| 5270 | this[i], |
|
| 5271 | // Make sure that we do not leak memory by inadvertently discarding |
|
| 5272 | // the original fragment (which might have attached data) instead of |
|
| 5273 | // using it; in addition, use the original fragment object for the last |
|
| 5274 | // item instead of first because it can end up being emptied incorrectly |
|
| 5275 | // in certain situations (Bug #8070). |
|
| 5276 | // Fragments from the fragment cache must always be cloned and never used |
|
| 5277 | // in place. |
|
| 5278 | results.cacheable || (l > 1 && i < lastIndex) ? |
|
| 5279 | jQuery.clone( fragment, true, true ) : |
|
| 5280 | fragment |
|
| 5281 | ); |
|
| 5282 | } |
|
| 5283 | } |
|
| 5284 | ||
| 5285 | if ( scripts.length ) { |
|
| 5286 | jQuery.each( scripts, evalScript ); |
|
| 5287 | } |
|
| 5288 | } |
|
| 5289 | ||
| 5290 | return this; |
|
| 5291 | } |
|
| 5292 | }); |
|
| 5293 | ||
| 5294 | function root( elem, cur ) { |
|