Commit 1a2fdafd authored by John Resig's avatar John Resig

Added a quick shortcut to improve the speed of $(DOMElement) by over 2x.

parent e6a481e5
...@@ -36,8 +36,14 @@ jQuery.fn = jQuery.prototype = { ...@@ -36,8 +36,14 @@ jQuery.fn = jQuery.prototype = {
// Make sure that a selection was provided // Make sure that a selection was provided
selector = selector || document; selector = selector || document;
// Handle $(DOMElement)
if ( selector.nodeType ) {
this[0] = selector;
this.length = 1;
return this;
// Handle HTML strings // Handle HTML strings
if ( typeof selector == "string" ) { } else if ( typeof selector == "string" ) {
// Are we dealing with HTML string or an ID? // Are we dealing with HTML string or an ID?
var match = quickExpr.exec( selector ); var match = quickExpr.exec( selector );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment