]> source.dussan.org Git - jquery-ui.git/commitdiff
Core: Modified widget factory to prevent access to internal methods through the API...
authorScott González <scott.gonzalez@gmail.com>
Sat, 16 Aug 2008 00:25:09 +0000 (00:25 +0000)
committerScott González <scott.gonzalez@gmail.com>
Sat, 16 Aug 2008 00:25:09 +0000 (00:25 +0000)
ui/ui.core.js

index fa9b0e91969b70a87723e9489473a78430e1bc5a..b101ee524edbaa0d91ab4978035ece49c5b84e64 100644 (file)
@@ -38,12 +38,19 @@ $.widget = function(name, prototype) {
                var isMethodCall = (typeof options == 'string'),
                        args = Array.prototype.slice.call(arguments, 1);
                
+               // prevent calls to internal methods
+               if (isMethodCall && options.substring(0, 1) == '_') {
+                       return this;
+               }
+               
+               // handle getter methods
                if (isMethodCall && getter(namespace, name, options)) {
                        var instance = $.data(this[0], name);
                        return (instance ? instance[options].apply(instance, args)
                                : undefined);
                }
                
+               // handle initialization and non-getter methods
                return this.each(function() {
                        var instance = $.data(this, name);
                        if (isMethodCall && instance && $.isFunction(instance[options])) {