git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bbf3334
)
Optimized jQuery(Element) to not call jQuery() twice.
author
John Resig
<jeresig@gmail.com>
Sat, 11 Jul 2009 13:44:44 +0000
(13:44 +0000)
committer
John Resig
<jeresig@gmail.com>
Sat, 11 Jul 2009 13:44:44 +0000
(13:44 +0000)
src/core.js
patch
|
blob
|
history
diff --git
a/src/core.js
b/src/core.js
index
78f48d7
..
cab3b54
100644
(file)
--- a/
src/core.js
+++ b/
src/core.js
@@
-72,10
+72,13
@@
jQuery.fn = jQuery.prototype = {
}
// Otherwise, we inject the element directly into the jQuery object
- ret = jQuery( elem || null );
- ret.context = document;
- ret.selector = selector;
- return ret;
+ this.length = elem ? 1 : 0;
+ if ( elem ) {
+ this[0] = elem;
+ }
+ this.context = document;
+ this.selector = selector;
+ return this;
}
// HANDLE: $(expr, $(...))