jQuery: The Write Less, Do More JavaScript Library

Changeset 5587

Show
Ignore:
Timestamp:
05/13/08 19:56:42 (3 months ago)
Author:
scott.gonzalez
Message:

widget factory: better arguments slicing thanks to Ariel.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/ui/ui.core.js

    r5584 r5587  
    111111        // create plugin method 
    112112        $.fn[name] = function(options, data) { 
    113             var isMethodCall = (typeof options == 'string'), 
    114                 args = arguments; 
     113            var isMethodCall = (typeof options == 'string'); 
     114            [].shift.call(arguments); 
    115115             
    116116            if (isMethodCall && getter(namespace, name, options)) { 
    117117                var instance = $.data(this[0], name); 
    118                 return (instance ? instance[options](data) : undefined);  
     118                return (instance ? instance[options].apply(instance, arguments) 
     119                    : undefined); 
    119120            } 
    120121             
     
    124125                    $.data(this, name, new $[namespace][name](this, options)); 
    125126                } else if (isMethodCall) { 
    126                     instance[options].apply(instance, $.makeArray(args).slice(1)); 
     127                    instance[options].apply(instance, arguments); 
    127128                } 
    128129            });