r2670 - spinner: minor refactor to _draw function and changed widget generated id so 'ui-spinner-...
Author: pazu2k@gmail.com
Date: Sun Jun 7 09:05:23 2009
New Revision: 2670
Modified:
branches/dev/spinner/ui/ui.spinner.js
Log:
spinner: minor refactor to _draw function and changed widget generated id
so 'ui-spinner-' preppended rather than appended.
Modified: branches/dev/spinner/ui/ui.spinner.js
==============================================================================
--- branches/dev/spinner/ui/ui.spinner.js (original)
+++ branches/dev/spinner/ui/ui.spinner.js Sun Jun 7 09:05:23 2009
@@ -213,11 +213,12 @@
},
_draw: function() {
- var dir = this.options.dir,
- spinnerClass = this.options.spinnerClass,
+ var self = this,
+ dir = self.options.dir,
+ spinnerClass = self.options.spinnerClass,
spinnerBoxClass = 'ui-spinner-box',
widgetClasses = 'ui-spinner ui-widget ui-widget-content ui-corner-all
ui-spinner-' + dir + (spinnerClass ? ' '+ spinnerClass: ''),
- widget = this.element
+ widget = self.element
.addClass(spinnerBoxClass)
.attr('autocomplete', 'off') // switch off autocomplete in opera
.wrap('<div>')
@@ -233,14 +234,14 @@
}
// force width if passed through options
- if (this.options.width)
- widget.find('.'+spinnerBoxClass).width(this.options.width);
+ if (self.options.width)
+ self.element.width(self.options.width);
// Give the spinner casing a unique id only if one exists in original
input
// - this should aid targetted customisations if a page contains
multiple instances
- widget.find('.'+spinnerBoxClass).attr('id', function(){
+ self.element.attr('id', function(){
if (this.id) {
- $(this).parent().attr('id', this.id + '-ui-spinner');
+ widget.attr('id', 'ui-spinner-'+ this.id);
}
});