git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added an optimization for the case where $("body") is used.
[jquery.git]
/
src
/
core.js
diff --git
a/src/core.js
b/src/core.js
index
890e9a2
..
5ccf158
100644
(file)
--- a/
src/core.js
+++ b/
src/core.js
@@
-48,6
+48,11
@@
jQuery.fn = jQuery.prototype = {
return this;
}
return this;
}
+ // $("body"): Shortcut for quickly finding the body element
+ if ( selector === "body" && !context && document.body ) {
+ selector = document.body;
+ }
+
// Handle $(DOMElement)
if ( selector.nodeType ) {
this.context = this[0] = selector;
// Handle $(DOMElement)
if ( selector.nodeType ) {
this.context = this[0] = selector;
@@
-316,7
+321,8
@@
jQuery.extend({
isXMLDoc: function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
isXMLDoc: function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
- return ((elem.ownerDocument || elem).documentElement || 0).nodeName !== "HTML";
+ var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
+ return documentElement ? documentElement.nodeName !== "HTML" : false;
},
// Evalulates a script in a global context
},
// Evalulates a script in a global context