Changeset 648

Show
Ignore:
Timestamp:
09/02/08 16:34:42 (19 months ago)
Author:
scott.gonzalez
Message:

Widget factory: Fixed #3275: Prevent multiple instantiations of the same plugin on a single element.

Files:
1 modified

Legend:

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

    r636 r648  
    9090                return this.each(function() { 
    9191                        var instance = $.data(this, name); 
    92                         if (isMethodCall && instance && $.isFunction(instance[options])) { 
    93                                 instance[options].apply(instance, args); 
    94                         } else if (!isMethodCall) { 
    95                                 $.data(this, name, new $[namespace][name](this, options)); 
    96                         } 
     92                         
     93                        // constructor 
     94                        (!instance && !isMethodCall && 
     95                                $.data(this, name, new $[namespace][name](this, options))); 
     96                         
     97                        // method call 
     98                        (instance && isMethodCall && 
     99                                instance[options].apply(instance, args)); 
    97100                }); 
    98101        };