@@ -68,66 +68,55 @@ $.fn.buttonMarkup = function( options ) {
6868 }
6969
7070 buttonClass = "ui-btn ui-btn-up-" + o . theme ;
71-
72- if ( o . inline ) {
73- buttonClass += " ui-btn-inline" ;
74- }
75-
76- if ( o . mini ) {
77- buttonClass += " ui-mini" ;
78- } else if ( o . mini && o . mini === false ) {
79- buttonClass += " ui-fullsize" ; // Used to control styling in headers/footers, where buttons default to `mini` style.
71+ buttonClass += o . inline ? " ui-btn-inline" : "" ;
72+ buttonClass += o . shadow ? " ui-shadow" : "" ;
73+ buttonClass += o . iconpos ? " ui-btn-icon-" + o . iconpos : "" ;
74+ buttonClass += o . corners ? " ui-btn-corner-all" : "" ;
75+
76+ if ( o . mini !== undefined ) {
77+ // Used to control styling in headers/footers, where buttons default to `mini` style.
78+ buttonClass += o . mini ? " ui-mini" : " ui-fullsize" ;
8079 }
8180
8281 if ( o . icon ) {
8382 o . icon = "ui-icon-" + o . icon ;
8483 o . iconpos = o . iconpos || "left" ;
8584
8685 iconClass = "ui-icon " + o . icon ;
87-
88- if ( o . iconshadow ) {
89- iconClass += " ui-icon-shadow" ;
90- }
91- }
92-
93- if ( o . iconpos ) {
94- buttonClass += " ui-btn-icon-" + o . iconpos ;
95-
96- if ( o . iconpos == "notext" && ! el . attr ( "title" ) ) {
97- el . attr ( "title" , el . getEncodedText ( ) ) ;
98- }
86+ iconClass += o . iconshadow ? " ui-icon-shadow" : "" ;
9987 }
88+
89+ innerClass += o . corners ? " ui-btn-corner-all" : "" ;
10090
101- if ( o . corners ) {
102- buttonClass += " ui-btn-corner-all" ;
103- innerClass += " ui-btn-corner-all" ;
91+ if ( o . iconpos && o . iconpos === "notext" && ! el . attr ( "title" ) ) {
92+ el . attr ( "title" , el . getEncodedText ( ) ) ;
10493 }
10594
106- if ( o . shadow ) {
107- buttonClass += " ui-shadow" ;
95+ if ( buttonElements ) {
96+ el . removeClass ( buttonElements . bcls || "" ) ;
10897 }
109-
110- if ( buttonElements )
111- el . removeClass ( ( buttonElements . bcls || "" ) ) ;
11298 el . removeClass ( "ui-link" ) . addClass ( buttonClass ) ;
11399
114100 buttonInner . className = innerClass ;
115101
116102 buttonText . className = textClass ;
117- if ( ! buttonElements )
103+ if ( ! buttonElements ) {
118104 buttonInner . appendChild ( buttonText ) ;
105+ }
119106 if ( buttonIcon ) {
120107 buttonIcon . className = iconClass ;
121- if ( ! ( buttonElements && buttonElements . icon ) )
108+ if ( ! ( buttonElements && buttonElements . icon ) ) {
122109 buttonInner . appendChild ( buttonIcon ) ;
110+ }
123111 }
124112
125113 while ( e . firstChild && ! buttonElements ) {
126114 buttonText . appendChild ( e . firstChild ) ;
127115 }
128116
129- if ( ! buttonElements )
117+ if ( ! buttonElements ) {
130118 e . appendChild ( buttonInner ) ;
119+ }
131120
132121 // Assign a structure containing the elements of this button to the elements of this button. This
133122 // will allow us to recognize this as an already-enhanced button in future calls to buttonMarkup().
@@ -142,8 +131,9 @@ $.fn.buttonMarkup = function( options ) {
142131 $ . data ( e , 'buttonElements' , buttonElements ) ;
143132 $ . data ( buttonInner , 'buttonElements' , buttonElements ) ;
144133 $ . data ( buttonText , 'buttonElements' , buttonElements ) ;
145- if ( buttonIcon )
134+ if ( buttonIcon ) {
146135 $ . data ( buttonIcon , 'buttonElements' , buttonElements ) ;
136+ }
147137 }
148138
149139 return this ;
0 commit comments