Skip to content

Commit 01c54ec

Browse files
committed
Button: Fixing issues found by jscs
1 parent 3223c29 commit 01c54ec

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

tests/unit/checkboxradio/checkboxradio.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
TestHelpers.loadResources({
1414
css: [ "ui.core", "ui.button", "ui.checkboxradio" ],
1515
js: [
16-
"ui/jquery.ui.core.js",
17-
"ui/jquery.ui.widget.js",
18-
"ui/jquery.ui.checkboxradio.js"
16+
"ui/core.js",
17+
"ui/widget.js",
18+
"ui/checkboxradio.js"
1919
]
2020
});
2121
</script>

ui/button.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,19 @@ $.widget( "ui.button", {
4646
iconPosition: "begining"
4747
},
4848

49-
_getCreateOptions: function () {
49+
_getCreateOptions: function() {
5050
var label,
5151
isDisabled = this.element.prop( "disabled" ),
5252
options = {};
5353

5454
this.isInput = this.element.is( "input" );
5555
label = ( this.isInput ? this.element.val() : this.element.html() );
5656

57-
if( typeof isDisabled !== "undefined" ) {
57+
if ( typeof isDisabled !== "undefined" ) {
5858
options.disabled = isDisabled;
5959
}
6060

61-
if( typeof label !== "undefined" && label !== "" ) {
61+
if ( typeof label !== "undefined" && label !== "" ) {
6262
options.label = label;
6363
}
6464

@@ -75,34 +75,34 @@ $.widget( "ui.button", {
7575
} else {
7676
this.options.disabled = !!this.element.prop( "disabled" );
7777
}
78-
if( this.options.disabled === true ){
78+
if ( this.options.disabled === true ){
7979
this._setOption( "disabled", true );
8080
}
8181

8282
this.element
8383
.addClass( baseClasses )
8484
.attr( "role", "button" );
8585

86-
if( this.options.icon ) {
86+
if ( this.options.icon ) {
8787
this.icon = $( "<span>" );
8888
this.icon.addClass( " ui-icon " + this.options.icon );
89-
if( this.options.iconPosition ) {
89+
if ( this.options.iconPosition ) {
9090
this.element.addClass( "ui-icon-" + this.options.iconPosition );
9191
}
92-
if( !this.options.showLabel ){
92+
if ( !this.options.showLabel ){
9393
this.element.addClass( " ui-button-icon-only" );
9494
}
9595
this.element.append( this.icon );
9696
this._setTitle();
9797
}
98-
if( this.options.label ){
99-
if( this.isInput ) {
98+
if ( this.options.label ){
99+
if ( this.isInput ) {
100100
this.element.val( this.options.label );
101101
} else {
102102
var textNode = this.element.contents().filter( function() {
103103
return this.nodeType === 3;
104104
})[ 0 ];
105-
if( textNode !== undefined ) {
105+
if ( textNode !== undefined ) {
106106
textNode.nodeValue = this.options.label;
107107
} else {
108108
this.element.html( this.options.label + this.element.html() );
@@ -124,7 +124,7 @@ $.widget( "ui.button", {
124124
this.title = this.element.attr( "title" );
125125
this.hasTitle = !!this.title;
126126

127-
if( !this.options.showLabel ){
127+
if ( !this.options.showLabel ){
128128
if ( !this.hasTitle ) {
129129
this.element.attr( "title", this.title );
130130
}
@@ -144,21 +144,21 @@ $.widget( "ui.button", {
144144
},
145145

146146
_setOption: function( key, value ) {
147-
if( key === "icon" ) {
147+
if ( key === "icon" ) {
148148
this.icon.addClass( " ui-icon " + value )
149149
.removeClass( this.options.icon );
150150
}
151-
if( key === "showLabel" ) {
151+
if ( key === "showLabel" ) {
152152
this.element.toggleClass( ".ui-button-icon-only", !( !!value ) )
153153
.toggleClass( this.options.iconPosition, !!value );
154154
this._setTitle();
155155
}
156-
if( key === "iconPosition" && this.options.showLabel ) {
156+
if ( key === "iconPosition" && this.options.showLabel ) {
157157
this.element.addClass( value )
158158
.removeClass( this.options.iconPosition );
159159
}
160-
if( key === "label" ) {
161-
if( this.element.is( "input" ) ) {
160+
if ( key === "label" ) {
161+
if ( this.element.is( "input" ) ) {
162162
this.element.val( value );
163163
} else {
164164
this.element.html( value );

ui/checkboxradio.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ $.widget( "ui.checkboxradio", {
6666
_create: function() {
6767
this.element.closest( "form" )
6868
.unbind( "reset" + "." + this.widgetName )
69-
.bind( "reset" + "."+ this.widgetName, formResetHandler );
69+
.bind( "reset" + "." + this.widgetName, formResetHandler );
7070

7171
if ( typeof this.options.disabled === "boolean" ) {
7272
this.element.prop( "disabled", this.options.disabled );
@@ -81,7 +81,7 @@ $.widget( "ui.checkboxradio", {
8181
this._enhance();
8282

8383
this._on({
84-
"change" : "_toggleClasses",
84+
"change": "_toggleClasses",
8585
"focus": "_handleFocus",
8686
"blur": "_handleBlur"
8787
});

0 commit comments

Comments
 (0)