aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.core.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2008-08-16 00:25:09 +0000
committerScott González <scott.gonzalez@gmail.com>2008-08-16 00:25:09 +0000
commit44140343f489842ec9ca92b072601bf7de7b4abe (patch)
tree9d431bfe1fe8f330889c383803e11c7a95ac88fd /ui/ui.core.js
parent4705f5cc2e6b73bb6b3a5f25fcf4955f3478c715 (diff)
downloadjquery-ui-44140343f489842ec9ca92b072601bf7de7b4abe.tar.gz
jquery-ui-44140343f489842ec9ca92b072601bf7de7b4abe.zip
Core: Modified widget factory to prevent access to internal methods through the API (internal methods are any methods preceded by an underscore). Provides framework for #3188.
Diffstat (limited to 'ui/ui.core.js')
-rw-r--r--ui/ui.core.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/ui/ui.core.js b/ui/ui.core.js
index fa9b0e919..b101ee524 100644
--- a/ui/ui.core.js
+++ b/ui/ui.core.js
@@ -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])) {