Skip to content

Commit bf6bbcd

Browse files
committed
Widget: Fix style issues
Closes gh-1500
1 parent 6b34ae9 commit bf6bbcd

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

ui/widget.js

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//>>docs: http://api.jqueryui.com/jQuery.widget/
1414
//>>demos: http://jqueryui.com/widget/
1515

16-
(function( factory ) {
16+
( function( factory ) {
1717
if ( typeof define === "function" && define.amd ) {
1818

1919
// AMD. Register as an anonymous module.
@@ -23,15 +23,15 @@
2323
// Browser globals
2424
factory( jQuery );
2525
}
26-
}(function( $ ) {
26+
}( function( $ ) {
2727

2828
var widget_uuid = 0,
2929
widget_slice = Array.prototype.slice;
3030

31-
$.cleanData = (function( orig ) {
31+
$.cleanData = ( function( orig ) {
3232
return function( elems ) {
3333
var events, elem, i;
34-
for ( i = 0; (elem = elems[i]) != null; i++ ) {
34+
for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
3535
try {
3636

3737
// Only trigger remove when necessary to save time
@@ -45,7 +45,7 @@ $.cleanData = (function( orig ) {
4545
}
4646
orig( elems );
4747
};
48-
})( $.cleanData );
48+
} )( $.cleanData );
4949

5050
$.widget = function( name, base, prototype ) {
5151
var fullName, existingConstructor, constructor, basePrototype,
@@ -90,7 +90,7 @@ $.widget = function( name, base, prototype ) {
9090
// track widgets that inherit from this widget in case this widget is
9191
// redefined after a widget inherits from it
9292
_childConstructors: []
93-
});
93+
} );
9494

9595
basePrototype = new base();
9696
// we need to make the options hash a property directly on the new instance
@@ -102,7 +102,7 @@ $.widget = function( name, base, prototype ) {
102102
proxiedPrototype[ prop ] = value;
103103
return;
104104
}
105-
proxiedPrototype[ prop ] = (function() {
105+
proxiedPrototype[ prop ] = ( function() {
106106
var _super = function() {
107107
return base.prototype[ prop ].apply( this, arguments );
108108
},
@@ -124,19 +124,19 @@ $.widget = function( name, base, prototype ) {
124124

125125
return returnValue;
126126
};
127-
})();
128-
});
127+
} )();
128+
} );
129129
constructor.prototype = $.widget.extend( basePrototype, {
130130
// TODO: remove support for widgetEventPrefix
131131
// always use the name + a colon as the prefix, e.g., draggable:start
132132
// don't prefix for widgets that aren't DOM-based
133-
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
133+
widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
134134
}, proxiedPrototype, {
135135
constructor: constructor,
136136
namespace: namespace,
137137
widgetName: name,
138138
widgetFullName: fullName
139-
});
139+
} );
140140

141141
// If this widget is being redefined then we need to find all widgets that
142142
// are inheriting from it and redefine all of them so that they inherit from
@@ -149,7 +149,7 @@ $.widget = function( name, base, prototype ) {
149149
// redefine the child widget using the same prototype that was
150150
// originally used, but inherit from the new version of the base
151151
$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
152-
});
152+
} );
153153
// remove the list of existing child constructors from the old constructor
154154
// so the old child constructors can be garbage collected
155155
delete existingConstructor._childConstructors;
@@ -196,7 +196,7 @@ $.widget.bridge = function( name, object ) {
196196
returnValue = this;
197197

198198
if ( isMethodCall ) {
199-
this.each(function() {
199+
this.each( function() {
200200
var methodValue,
201201
instance = $.data( this, fullName );
202202
if ( options === "instance" ) {
@@ -207,7 +207,7 @@ $.widget.bridge = function( name, object ) {
207207
return $.error( "cannot call methods on " + name + " prior to initialization; " +
208208
"attempted to call method '" + options + "'" );
209209
}
210-
if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
210+
if ( !$.isFunction( instance[ options ] ) || options.charAt( 0 ) === "_" ) {
211211
return $.error( "no such method '" + options + "' for " + name + " widget instance" );
212212
}
213213
methodValue = instance[ options ].apply( instance, args );
@@ -217,15 +217,15 @@ $.widget.bridge = function( name, object ) {
217217
methodValue;
218218
return false;
219219
}
220-
});
220+
} );
221221
} else {
222222

223223
// Allow multiple hashes to be passed on init
224224
if ( args.length ) {
225-
options = $.widget.extend.apply( null, [ options ].concat(args) );
225+
options = $.widget.extend.apply( null, [ options ].concat( args ) );
226226
}
227227

228-
this.each(function() {
228+
this.each( function() {
229229
var instance = $.data( this, fullName );
230230
if ( instance ) {
231231
instance.option( options || {} );
@@ -235,7 +235,7 @@ $.widget.bridge = function( name, object ) {
235235
} else {
236236
$.data( this, fullName, new object( options, this ) );
237237
}
238-
});
238+
} );
239239
}
240240

241241
return returnValue;
@@ -275,13 +275,13 @@ $.Widget.prototype = {
275275
this.destroy();
276276
}
277277
}
278-
});
278+
} );
279279
this.document = $( element.style ?
280280
// element within the document
281281
element.ownerDocument :
282282
// element is window or document
283283
element.document || element );
284-
this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
284+
this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
285285
}
286286

287287
this.options = $.widget.extend( {},
@@ -304,7 +304,7 @@ $.Widget.prototype = {
304304
this._destroy();
305305
$.each( this.classesElementLookup, function( key, value ) {
306306
that._removeClass( value, key );
307-
});
307+
} );
308308

309309
// we can probably remove the unbind calls in 2.0
310310
// all event bindings should go through this._on()
@@ -413,27 +413,27 @@ $.Widget.prototype = {
413413
// for generating the string of classes. We want to use the value passed in from
414414
// _setOption(), this is the new value of the classes option which was passed to
415415
// _setOption(). We pass this value directly to _classes().
416-
elements.addClass( this._classes({
416+
elements.addClass( this._classes( {
417417
element: elements,
418418
keys: classKey,
419419
classes: value,
420420
add: true
421-
}));
421+
} ) );
422422
}
423423
},
424424

425425
enable: function() {
426-
return this._setOptions({ disabled: false });
426+
return this._setOptions( { disabled: false } );
427427
},
428428
disable: function() {
429-
return this._setOptions({ disabled: true });
429+
return this._setOptions( { disabled: true } );
430430
},
431431

432432
_classes: function( options ) {
433433
var full = [],
434434
that = this;
435435

436-
options = $.extend({
436+
options = $.extend( {
437437
element: this.element,
438438
classes: this.options.classes || {}
439439
}, options );
@@ -514,7 +514,7 @@ $.Widget.prototype = {
514514
// - disabled class as method for disabling individual parts
515515
if ( !suppressDisabledCheck &&
516516
( instance.options.disabled === true ||
517-
$( this ).hasClass( "ui-state-disabled" ) ) ) {
517+
$( this ).hasClass( "ui-state-disabled" ) ) ) {
518518
return;
519519
}
520520
return ( typeof handler === "string" ? instance[ handler ] : handler )
@@ -528,18 +528,18 @@ $.Widget.prototype = {
528528
}
529529

530530
var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
531-
eventName = match[1] + instance.eventNamespace,
532-
selector = match[2];
531+
eventName = match[ 1 ] + instance.eventNamespace,
532+
selector = match[ 2 ];
533533
if ( selector ) {
534534
delegateElement.delegate( selector, eventName, handlerProxy );
535535
} else {
536536
element.bind( eventName, handlerProxy );
537537
}
538-
});
538+
} );
539539
},
540540

541541
_off: function( element, eventName ) {
542-
eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) +
542+
eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
543543
this.eventNamespace;
544544
element.unbind( eventName ).undelegate( eventName );
545545

@@ -567,7 +567,7 @@ $.Widget.prototype = {
567567
mouseleave: function( event ) {
568568
this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
569569
}
570-
});
570+
} );
571571
},
572572

573573
_focusable: function( element ) {
@@ -579,7 +579,7 @@ $.Widget.prototype = {
579579
focusout: function( event ) {
580580
this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
581581
}
582-
});
582+
} );
583583
},
584584

585585
_trigger: function( type, event, data ) {
@@ -607,7 +607,7 @@ $.Widget.prototype = {
607607

608608
this.element.trigger( event, data );
609609
return !( $.isFunction( callback ) &&
610-
callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
610+
callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
611611
event.isDefaultPrevented() );
612612
}
613613
};
@@ -637,17 +637,17 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
637637
} else if ( effectName !== method && element[ effectName ] ) {
638638
element[ effectName ]( options.duration, options.easing, callback );
639639
} else {
640-
element.queue(function( next ) {
640+
element.queue( function( next ) {
641641
$( this )[ method ]();
642642
if ( callback ) {
643643
callback.call( element[ 0 ] );
644644
}
645645
next();
646-
});
646+
} );
647647
}
648648
};
649-
});
649+
} );
650650

651651
return $.widget;
652652

653-
}));
653+
} ) );

0 commit comments

Comments
 (0)