mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
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.
This commit is contained in:
parent
eab0a6dac1
commit
6ba75aa698
22
ui/jquery.ui.widget.js
vendored
22
ui/jquery.ui.widget.js
vendored
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user