From 9d88b565d6f65dc1aaebfaf99699f6155370949c Mon Sep 17 00:00:00 2001 From: Scott González Date: Mon, 27 Sep 2010 11:21:09 -0400 Subject: Widget: Added _setOptions method for handling normalized options setting. Fixes #6114 - Widget: Add _setOptions() method. --- ui/jquery.ui.widget.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'ui/jquery.ui.widget.js') diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index aef9b8378..866f7441e 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -176,12 +176,11 @@ $.Widget.prototype = { }, option: function( key, value ) { - var options = key, - self = this; + var options = key; if ( arguments.length === 0 ) { // don't return a reference to the internal hash - return $.extend( {}, self.options ); + return $.extend( {}, this.options ); } if (typeof key === "string" ) { @@ -192,11 +191,17 @@ $.Widget.prototype = { options[ key ] = value; } + this._setOptions( options ); + + return this; + }, + _setOptions: function( options ) { + var self = this; $.each( options, function( key, value ) { self._setOption( key, value ); }); - return self; + return this; }, _setOption: function( key, value ) { this.options[ key ] = value; -- cgit v1.2.3