r2947 - spinner: cleaned up _setData
Author: pazu2k@gmail.com
Date: Mon Jul 20 02:13:08 2009
New Revision: 2947
Modified:
branches/dev/spinner/ui/ui.spinner.js
Log:
spinner: cleaned up _setData
Modified: branches/dev/spinner/ui/ui.spinner.js
==============================================================================
--- branches/dev/spinner/ui/ui.spinner.js (original)
+++ branches/dev/spinner/ui/ui.spinner.js Mon Jul 20 02:13:08 2009
@@ -382,28 +382,36 @@
return this;
},
_setData: function(key, value) {
+ $.widget.prototype._setData.call(this, key, value);
+
+ if (key == 'hide' && typeof value != 'boolean') {
+ this[this.hovered || this.focused ? '_show' : '_hide']();
+ return;
+ }
+ if (key == 'hide' && value) {
+ this._hide();
+ return;
+ }
if (key == 'hide') {
- if (typeof value != 'boolean') {
- this[this.hovered || this.focused ? '_show' : '_hide']();
- } else if (value) {
- this._hide();
- } else {
- this._show();
- }
+ this._show();
+ return;
}
+
// write attributes back to element if original exist
- else if ($.inArray(key, ['min','max','step']) != -1 &&
this.element.attr(key) && this.options[key] != null) {
+ if ($.inArray(key, ['min','max','step']) != -1 && this.element.attr(key)
&& this.options[key] != null) {
this.element.attr(key, value);
+ return;
}
// aria properties
if (key == 'min') {
this.element.parent().attr('aria-valuemin', value);
- } else if (key == 'max') {
+ return;
+ }
+ if (key == 'max') {
this.element.parent().attr('aria-valuemax', value);
+ return;
}
-
- $.widget.prototype._setData.call(this, key, value);
},
_parse: function(val) {
if (typeof val == 'string') {