git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
A speedup for .remove() (which also speeds up .html()). Fixes #4178.
[jquery.git]
/
src
/
core.js
diff --git
a/src/core.js
b/src/core.js
index
b3142d0
..
c7d10f3
100644
(file)
--- a/
src/core.js
+++ b/
src/core.js
@@
-75,7
+75,9
@@
jQuery.fn = jQuery.prototype = {
this.context = selector.context;
}
this.context = selector.context;
}
- return this.setArray(jQuery.makeArray(selector));
+ return this.setArray(jQuery.isArray( selector ) ?
+ selector :
+ jQuery.makeArray(selector));
},
// Start with an empty selector
},
// Start with an empty selector
@@
-95,7
+97,7
@@
jQuery.fn = jQuery.prototype = {
return num === undefined ?
// Return a 'clean' array
return num === undefined ?
// Return a 'clean' array
- jQuery.makeArray( this ) :
+ Array.prototype.slice.call( this ) :
// Return just the object
this[ num ];
// Return just the object
this[ num ];
@@
-265,8
+267,10
@@
jQuery.fn = jQuery.prototype = {
},
// For internal use only.
},
// For internal use only.
- // Behaves like an Array's .push method, not like a jQuery method.
+ // Behaves like an Array's method, not like a jQuery method.
push: [].push,
push: [].push,
+ sort: [].sort,
+ splice: [].splice,
find: function( selector ) {
if ( this.length === 1 ) {
find: function( selector ) {
if ( this.length === 1 ) {
@@
-1230,7
+1234,7
@@
jQuery.each({
empty: function() {
// Remove element nodes and prevent memory leaks
empty: function() {
// Remove element nodes and prevent memory leaks
- jQuery( ">*", this ).remove();
+ jQuery(this).children().remove();
// Remove any remaining nodes
while ( this.firstChild )
// Remove any remaining nodes
while ( this.firstChild )