@@ -36,7 +36,7 @@ $.widget( "ui.progressbar", {
36
36
"aria-valuenow" : this . options . value
37
37
} ) ;
38
38
39
- this . valueDiv = $ ( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'><div></div>< /div>" )
39
+ this . valueDiv = $ ( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
40
40
. appendTo ( this . element ) ;
41
41
42
42
this . oldValue = this . options . value ;
@@ -114,11 +114,29 @@ $.widget( "ui.progressbar", {
114
114
115
115
_refreshValue : function ( ) {
116
116
var value = this . options . value ,
117
- percentage = this . _percentage ( ) ,
118
- overlay = this . valueDiv . children ( ) . eq ( 0 ) ;
117
+ percentage = this . _percentage ( ) ;
119
118
120
- overlay . toggleClass ( "ui-progressbar-overlay" , this . indeterminate ) ;
121
- this . valueDiv . toggleClass ( "ui-progressbar-indeterminate" , this . indeterminate ) ;
119
+ this . valueDiv
120
+ . toggle ( this . indeterminate || value > this . min )
121
+ . toggleClass ( "ui-corner-right" , value === this . options . max )
122
+ . toggleClass ( "ui-progressbar-indeterminate" , this . indeterminate )
123
+ . width ( percentage . toFixed ( 0 ) + "%" ) ;
124
+
125
+ if ( this . indeterminate ) {
126
+ this . element . removeAttr ( "aria-valuemax" ) . removeAttr ( "aria-valuenow" ) ;
127
+ if ( ! this . overlayDiv ) {
128
+ this . overlayDiv = $ ( "<div class='ui-progressbar-overlay'></div>" ) . appendTo ( this . valueDiv ) ;
129
+ }
130
+ } else {
131
+ this . element . attr ( {
132
+ "aria-valuemax" : this . options . max ,
133
+ "aria-valuenow" : value
134
+ } ) ;
135
+ if ( this . overlayDiv ) {
136
+ this . overlayDiv . remove ( ) ;
137
+ this . overlayDiv = null ;
138
+ }
139
+ }
122
140
123
141
if ( this . oldValue !== value ) {
124
142
this . oldValue = value ;
@@ -127,18 +145,6 @@ $.widget( "ui.progressbar", {
127
145
if ( value === this . options . max ) {
128
146
this . _trigger ( "complete" ) ;
129
147
}
130
-
131
- this . valueDiv
132
- . toggle ( this . indeterminate || value > this . min )
133
- . toggleClass ( "ui-corner-right" , value === this . options . max )
134
- . width ( percentage . toFixed ( 0 ) + "%" ) ;
135
- if ( this . indeterminate ) {
136
- this . element . removeAttr ( "aria-valuemax" ) ;
137
- this . element . removeAttr ( "aria-valuenow" ) ;
138
- } else {
139
- this . element . attr ( "aria-valuemax" , this . options . max ) ;
140
- this . element . attr ( "aria-valuenow" , value ) ;
141
- }
142
148
}
143
149
} ) ;
144
150
0 commit comments