From c94ec23b263464af3dfa4533eff45fc0d6fef954 Mon Sep 17 00:00:00 2001 From: William Kevin Manire Date: Wed, 16 Feb 2011 00:28:32 -0800 Subject: Widget: modified widget to throw exception on attempt to call private methods. Fixed #6947 - Attempt to access private member of widget returns jQuery object --- ui/jquery.ui.widget.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'ui/jquery.ui.widget.js') diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 0a4759023..10a25b611 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -104,11 +104,6 @@ $.widget.bridge = function( name, object ) { $.extend.apply( null, [ true, options ].concat(args) ) : options; - // prevent calls to internal methods - if ( isMethodCall && options.charAt( 0 ) === "_" ) { - return returnValue; - } - if ( isMethodCall ) { this.each(function() { var instance = $.data( this, name ); @@ -116,7 +111,7 @@ $.widget.bridge = function( name, object ) { return $.error( "cannot call methods on " + name + " prior to initialization; " + "attempted to call method '" + options + "'" ); } - if ( !$.isFunction( instance[options] ) ) { + if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { return $.error( "no such method '" + options + "' for " + name + " widget instance" ); } var methodValue = instance[ options ].apply( instance, args ); -- cgit v1.2.3