From 23461fe785d9235db8a3171dec882e94a6a5ca41 Mon Sep 17 00:00:00 2001 From: Daniel Steigerwald Date: Sun, 19 Sep 2010 12:25:50 +0200 Subject: [PATCH 1/3] cleanup the code a wee bit --- ui/jquery.ui.widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index dbfea257422..330d5330197 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -90,7 +90,7 @@ $.widget.bridge = function( name, object ) { options; // prevent calls to internal methods - if ( isMethodCall && options.substring( 0, 1 ) === "_" ) { + if (isMethodCall && options.charAt( 0 ) == "_") { return returnValue; } From b7f7e419f05073a2742a8f8d6d9a2ef2d2253ae7 Mon Sep 17 00:00:00 2001 From: Daniel Steigerwald Date: Sun, 19 Sep 2010 12:48:15 +0200 Subject: [PATCH 2/3] widget lazy init, ex. $('#dialog').dialog('open'); --- ui/jquery.ui.widget.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 330d5330197..0cf28d52796 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -98,8 +98,8 @@ $.widget.bridge = function( name, object ) { this.each(function() { var instance = $.data( this, name ); if ( !instance ) { - throw "cannot call methods on " + name + " prior to initialization; " + - "attempted to call method '" + options + "'"; + // allow lazy initialization + instance = $.data( this, name, new object( null, this )); } if ( !$.isFunction( instance[options] ) ) { throw "no such method '" + options + "' for " + name + " widget instance"; From 669debd8f2365b31eee6c00ca9288836a7ae14f1 Mon Sep 17 00:00:00 2001 From: Daniel Steigerwald Date: Mon, 20 Sep 2010 20:49:54 +0200 Subject: [PATCH 3/3] fixed whitespaces and equality check --- ui/jquery.ui.widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 0cf28d52796..2aef8f96a5b 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -90,7 +90,7 @@ $.widget.bridge = function( name, object ) { options; // prevent calls to internal methods - if (isMethodCall && options.charAt( 0 ) == "_") { + if ( isMethodCall && options.charAt( 0 ) === "_" ) { return returnValue; }