Bug Tracker

Changeset 5479

Show
Ignore:
Timestamp:
05/06/08 22:36:30 (8 months ago)
Author:
aflesler
Message:

jquery core: removing needless 'else' and 'new' in $.fn.init.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/jquery/src/core.js

    r5470 r5479  
    3737            this.length = 1; 
    3838            return this; 
    39  
     39        } 
    4040        // Handle HTML strings 
    41         } else if ( typeof selector == "string" ) { 
     41        if ( typeof selector == "string" ) { 
    4242            // Are we dealing with HTML string or an ID? 
    4343            var match = quickExpr.exec( selector ); 
     
    5555 
    5656                    // Make sure an element was located 
    57                     if ( elem ) 
     57                    if ( elem ){ 
    5858                        // Handle the case where IE and Opera return items 
    5959                        // by name instead of ID 
     
    6262 
    6363                        // Otherwise, we inject the element directly into the jQuery object 
    64                         else { 
    65                             this[0] = elem; 
    66                             this.length = 1; 
    67                             return this; 
    68                         } 
    69  
    70                     else 
    71                         selector = []; 
     64                        return jQuery( elem ); 
     65                    } 
     66                    selector = []; 
    7267                } 
    7368 
     
    7570            // (which is just equivalent to: $(content).find(expr) 
    7671            } else 
    77                 return new jQuery( context ).find( selector ); 
     72                return jQuery( context ).find( selector ); 
    7873 
    7974        // HANDLE: $(function) 
    8075        // Shortcut for document ready 
    8176        } else if ( jQuery.isFunction( selector ) ) 
    82             return new jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector ); 
     77            return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector ); 
    8378         
    8479        return this.setArray(jQuery.makeArray(selector));