aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.widget.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2010-10-21 09:52:27 -0400
committerScott González <scott.gonzalez@gmail.com>2010-10-21 09:52:27 -0400
commit6ba75aa698361bf8c87ac7037570a5daaad3b49a (patch)
treeab487da2536b1f74aa174bd27aff4824ca12ec5e /ui/jquery.ui.widget.js
parenteab0a6dac13b642a870747249a360bdddb39da99 (diff)
downloadjquery-ui-6ba75aa698361bf8c87ac7037570a5daaad3b49a.tar.gz
jquery-ui-6ba75aa698361bf8c87ac7037570a5daaad3b49a.zip
Widget: Don't throw errors for invalid method calls (wait till 1.9 to add this back). Reverts fix for #5972 - Widget: Throw error for non-existent method calls.
Diffstat (limited to 'ui/jquery.ui.widget.js')
-rw-r--r--ui/jquery.ui.widget.js22
1 files changed, 13 insertions, 9 deletions
diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js
index 95923eddd..fadf81f2b 100644
--- a/ui/jquery.ui.widget.js
+++ b/ui/jquery.ui.widget.js
@@ -96,15 +96,19 @@ $.widget.bridge = function( name, object ) {
if ( isMethodCall ) {
this.each(function() {
- var instance = $.data( this, name );
- if ( !instance ) {
- throw "cannot call methods on " + name + " prior to initialization; " +
- "attempted to call method '" + options + "'";
- }
- if ( !$.isFunction( instance[options] ) ) {
- throw "no such method '" + options + "' for " + name + " widget instance";
- }
- var methodValue = instance[ options ].apply( instance, args );
+ var instance = $.data( this, name ),
+ methodValue = instance && $.isFunction( instance[options] ) ?
+ instance[ options ].apply( instance, args ) :
+ instance;
+ // TODO: add this back in 1.9 and use $.error() (see #5972)
+// if ( !instance ) {
+// throw "cannot call methods on " + name + " prior to initialization; " +
+// "attempted to call method '" + options + "'";
+// }
+// if ( !$.isFunction( instance[options] ) ) {
+// throw "no such method '" + options + "' for " + name + " widget instance";
+// }
+// var methodValue = instance[ options ].apply( instance, args );
if ( methodValue !== instance && methodValue !== undefined ) {
returnValue = methodValue;
return false;