Skip to content

Commit f349f90

Browse files
committed
Progressbar: Conform to coding standards.
1 parent 573a402 commit f349f90

File tree

1 file changed

+36
-48
lines changed

1 file changed

+36
-48
lines changed

ui/jquery.ui.progressbar.js

Lines changed: 36 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -11,109 +11,97 @@
1111
* jquery.ui.core.js
1212
* jquery.ui.widget.js
1313
*/
14-
(function($) {
14+
(function( $ ) {
1515

16-
$.widget("ui.progressbar", {
16+
$.widget( "ui.progressbar", {
1717
options: {
1818
value: 0
1919
},
2020
_create: function() {
21-
2221
this.element
23-
.addClass("ui-progressbar"
24-
+ " ui-widget"
25-
+ " ui-widget-content"
26-
+ " ui-corner-all")
22+
.addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
2723
.attr({
2824
role: "progressbar",
2925
"aria-valuemin": this._valueMin(),
3026
"aria-valuemax": this._valueMax(),
3127
"aria-valuenow": this._value()
3228
});
3329

34-
this.valueDiv = $('<div class="ui-progressbar-value ui-widget-header ui-corner-left"></div>').appendTo(this.element);
30+
this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
31+
.appendTo( this.element );
3532

3633
this._refreshValue();
37-
3834
},
3935

4036
destroy: function() {
41-
4237
this.element
43-
.removeClass("ui-progressbar"
44-
+ " ui-widget"
45-
+ " ui-widget-content"
46-
+ " ui-corner-all")
47-
.removeAttr("role")
48-
.removeAttr("aria-valuemin")
49-
.removeAttr("aria-valuemax")
50-
.removeAttr("aria-valuenow")
51-
.removeData("progressbar")
52-
.unbind(".progressbar");
38+
.removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
39+
.removeAttr( "role" )
40+
.removeAttr( "aria-valuemin" )
41+
.removeAttr( "aria-valuemax" )
42+
.removeAttr( "aria-valuenow" );
5343

5444
this.valueDiv.remove();
5545

56-
$.Widget.prototype.destroy.apply(this, arguments);
57-
58-
return this;
46+
$.Widget.prototype.destroy.apply( this, arguments );
5947
},
6048

61-
value: function(newValue) {
62-
if (newValue === undefined) {
49+
value: function( newValue ) {
50+
if ( newValue === undefined ) {
6351
return this._value();
6452
}
65-
66-
this._setOption('value', newValue);
53+
54+
this._setOption( "value", newValue );
6755
return this;
6856
},
6957

70-
_setOption: function(key, value) {
71-
72-
switch (key) {
73-
case 'value':
58+
_setOption: function( key, value ) {
59+
switch ( key ) {
60+
case "value":
7461
this.options.value = value;
7562
this._refreshValue();
76-
this._trigger('change', null, {});
63+
this._trigger( "change" );
7764
break;
7865
}
7966

80-
$.Widget.prototype._setOption.apply(this, arguments);
81-
67+
$.Widget.prototype._setOption.apply( this, arguments );
8268
},
8369

8470
_value: function() {
8571
var val = this.options.value;
8672
// normalize invalid value
87-
if (typeof val != "number")
73+
if ( typeof val !== "number" ) {
8874
val = 0;
89-
if (val < this._valueMin()) val = this._valueMin();
90-
if (val > this._valueMax()) val = this._valueMax();
75+
}
76+
if ( val < this._valueMin() ) {
77+
val = this._valueMin();
78+
}
79+
if ( val > this._valueMax() ) {
80+
val = this._valueMax();
81+
}
9182

9283
return val;
93-
9484
},
9585

9686
_valueMin: function() {
97-
var valueMin = 0;
98-
return valueMin;
87+
return 0;
9988
},
10089

10190
_valueMax: function() {
102-
var valueMax = 100;
103-
return valueMax;
91+
return 100;
10492
},
10593

10694
_refreshValue: function() {
10795
var value = this.value();
108-
this.valueDiv[value == this._valueMax() ? 'addClass' : 'removeClass']("ui-corner-right");
109-
this.valueDiv.width(value + '%');
110-
this.element.attr("aria-valuenow", value);
96+
this.valueDiv
97+
[ value === this._valueMax() ? "addClass" : "removeClass"]( "ui-corner-right" )
98+
.width( value + "%" );
99+
this.element.attr( "aria-valuenow", value );
111100
}
112-
113101
});
114102

115-
$.extend($.ui.progressbar, {
103+
$.extend( $.ui.progressbar, {
116104
version: "@VERSION"
117105
});
118106

119-
})(jQuery);
107+
})( jQuery );

0 commit comments

Comments
 (0)