Skip to content
Permalink
Browse files

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

  • Loading branch information
jeresig committed Nov 27, 2007
1 parent e6a481e commit 1a2fdafd386a8f7be8b633634a684969921f8b8f
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/core.js
@@ -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 );

0 comments on commit 1a2fdaf

Please sign in to comment.
You can’t perform that action at this time.