Changeset 636
- Timestamp:
- 08/26/08 19:44:12 (19 months ago)
- Files:
-
- 1 modified
-
trunk/ui/ui.core.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ui/ui.core.js
r616 r636 53 53 // taking some boilerplate code out of the plugin code 54 54 // created by Scott González and Jörn Zaefferer 55 function getter(namespace, plugin, method) { 56 var methods = $[namespace][plugin].getter || []; 57 methods = (typeof methods == "string" ? methods.split(/,?\s+/) : methods); 55 function getter(namespace, plugin, method, args) { 56 function getMethods(type) { 57 var methods = $[namespace][plugin][type] || []; 58 return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods); 59 } 60 61 var methods = getMethods('getter'); 62 if (args.length == 1 && typeof args[0] == 'string') { 63 methods = methods.concat(getMethods('getterSetter')); 64 } 58 65 return ($.inArray(method, methods) != -1); 59 66 } … … 74 81 75 82 // handle getter methods 76 if (isMethodCall && getter(namespace, name, options )) {83 if (isMethodCall && getter(namespace, name, options, args)) { 77 84 var instance = $.data(this[0], name); 78 85 return (instance ? instance[options].apply(instance, args) … … 121 128 // add widget prototype 122 129 $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype); 130 131 // TODO: merge getter and getterSetter properties from widget prototype 132 // and plugin prototype 133 $[namespace][name].getterSetter = 'option'; 123 134 }; 124 135 … … 129 140 }, 130 141 142 option: function(key, value) { 143 var options = key, 144 self = this; 145 146 if (typeof key == "string") { 147 if (value === undefined) { 148 return this._getData(key); 149 } 150 options = {}; 151 options[key] = value; 152 } 153 154 $.each(options, function(key, value) { 155 self._setData(key, value); 156 }); 157 }, 131 158 _getData: function(key) { 132 159 return this.options[key];