Skip to content

Commit

Permalink
Added a quick shortcut to improve the speed of $(DOMElement) by over 2x.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeresig committed Nov 27, 2007
1 parent e6a481e commit 1a2fdaf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/core.js
Expand Up @@ -36,8 +36,14 @@ jQuery.fn = jQuery.prototype = {
// Make sure that a selection was provided
selector = selector || document;

// Handle $(DOMElement)
if ( selector.nodeType ) {
this[0] = selector;
this.length = 1;
return this;

// Handle HTML strings
if ( typeof selector == "string" ) {
} else if ( typeof selector == "string" ) {
// Are we dealing with HTML string or an ID?
var match = quickExpr.exec( selector );

Expand Down

0 comments on commit 1a2fdaf

Please sign in to comment.