@@ -36,7 +36,7 @@ $.widget( "ui.progressbar", {
3636 "aria-valuenow" : this . options . value
3737 } ) ;
3838
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>" )
4040 . appendTo ( this . element ) ;
4141
4242 this . oldValue = this . options . value ;
@@ -114,11 +114,29 @@ $.widget( "ui.progressbar", {
114114
115115 _refreshValue : function ( ) {
116116 var value = this . options . value ,
117- percentage = this . _percentage ( ) ,
118- overlay = this . valueDiv . children ( ) . eq ( 0 ) ;
117+ percentage = this . _percentage ( ) ;
119118
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+ }
122140
123141 if ( this . oldValue !== value ) {
124142 this . oldValue = value ;
@@ -127,18 +145,6 @@ $.widget( "ui.progressbar", {
127145 if ( value === this . options . max ) {
128146 this . _trigger ( "complete" ) ;
129147 }
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- }
142148 }
143149} ) ;
144150
0 commit comments