1313//>>docs: http://api.jqueryui.com/jQuery.widget/
1414//>>demos: http://jqueryui.com/widget/
1515
16- ( function ( factory ) {
16+ ( function ( factory ) {
1717if ( typeof define === "function" && define . amd ) {
1818
1919// AMD. Register as an anonymous module.
2323// Browser globals
2424factory ( jQuery ) ;
2525}
26- } ( function ( $ ) {
26+ } ( function ( $ ) {
2727
2828var widget_uuid = 0 ,
2929widget_slice = Array . prototype . slice ;
3030
31- $ . cleanData = ( function ( orig ) {
31+ $ . cleanData = ( function ( orig ) {
3232return function ( elems ) {
3333var events , elem , i ;
34- for ( i = 0 ; ( elem = elems [ i ] ) != null ; i ++ ) {
34+ for ( i = 0 ; ( elem = elems [ i ] ) != null ; i ++ ) {
3535try {
3636
3737// Only trigger remove when necessary to save time
@@ -45,7 +45,7 @@ $.cleanData = (function( orig ) {
4545}
4646orig ( elems ) ;
4747} ;
48- } ) ( $ . cleanData ) ;
48+ } ) ( $ . cleanData ) ;
4949
5050$ . widget = function ( name , base , prototype ) {
5151var 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
9595basePrototype = 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 ) {
102102proxiedPrototype [ prop ] = value ;
103103return ;
104104}
105- proxiedPrototype [ prop ] = ( function ( ) {
105+ proxiedPrototype [ prop ] = ( function ( ) {
106106var _super = function ( ) {
107107return base . prototype [ prop ] . apply ( this , arguments ) ;
108108} ,
@@ -124,19 +124,19 @@ $.widget = function( name, base, prototype ) {
124124
125125return returnValue ;
126126} ;
127- } ) ( ) ;
128- } ) ;
127+ } ) ( ) ;
128+ } ) ;
129129constructor . 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 , {
135135constructor : constructor ,
136136namespace : namespace ,
137137widgetName : name ,
138138widgetFullName : 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
155155delete existingConstructor . _childConstructors ;
@@ -196,7 +196,7 @@ $.widget.bridge = function( name, object ) {
196196returnValue = this ;
197197
198198if ( isMethodCall ) {
199- this . each ( function ( ) {
199+ this . each ( function ( ) {
200200var methodValue ,
201201instance = $ . data ( this , fullName ) ;
202202if ( options === "instance" ) {
@@ -207,7 +207,7 @@ $.widget.bridge = function( name, object ) {
207207return $ . 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 ) === "_" ) {
211211return $ . error ( "no such method '" + options + "' for " + name + " widget instance" ) ;
212212}
213213methodValue = instance [ options ] . apply ( instance , args ) ;
@@ -217,15 +217,15 @@ $.widget.bridge = function( name, object ) {
217217methodValue ;
218218return false ;
219219}
220- } ) ;
220+ } ) ;
221221} else {
222222
223223// Allow multiple hashes to be passed on init
224224if ( 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 ( ) {
229229var instance = $ . data ( this , fullName ) ;
230230if ( instance ) {
231231instance . 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
241241return returnValue ;
@@ -275,13 +275,13 @@ $.Widget.prototype = {
275275this . destroy ( ) ;
276276}
277277}
278- } ) ;
278+ } ) ;
279279this . document = $ ( element . style ?
280280// element within the document
281281element . ownerDocument :
282282// element is window or document
283283element . 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
287287this . options = $ . widget . extend ( { } ,
@@ -304,7 +304,7 @@ $.Widget.prototype = {
304304this . _destroy ( ) ;
305305$ . each ( this . classesElementLookup , function ( key , value ) {
306306that . _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 ( {
417417element : elements ,
418418keys : classKey ,
419419classes : value ,
420420add : true
421- } ) ) ;
421+ } ) ) ;
422422}
423423} ,
424424
425425enable : function ( ) {
426- return this . _setOptions ( { disabled : false } ) ;
426+ return this . _setOptions ( { disabled : false } ) ;
427427} ,
428428disable : function ( ) {
429- return this . _setOptions ( { disabled : true } ) ;
429+ return this . _setOptions ( { disabled : true } ) ;
430430} ,
431431
432432_classes : function ( options ) {
433433var full = [ ] ,
434434that = this ;
435435
436- options = $ . extend ( {
436+ options = $ . extend ( {
437437element : this . element ,
438438classes : this . options . classes || { }
439439} , options ) ;
@@ -514,7 +514,7 @@ $.Widget.prototype = {
514514// - disabled class as method for disabling individual parts
515515if ( ! suppressDisabledCheck &&
516516( instance . options . disabled === true ||
517- $ ( this ) . hasClass ( "ui-state-disabled" ) ) ) {
517+ $ ( this ) . hasClass ( "ui-state-disabled" ) ) ) {
518518return ;
519519}
520520return ( typeof handler === "string" ? instance [ handler ] : handler )
@@ -528,18 +528,18 @@ $.Widget.prototype = {
528528}
529529
530530var 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 ] ;
533533if ( selector ) {
534534delegateElement . delegate ( selector , eventName , handlerProxy ) ;
535535} else {
536536element . 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 + " " ) +
543543this . eventNamespace ;
544544element . unbind ( eventName ) . undelegate ( eventName ) ;
545545
@@ -567,7 +567,7 @@ $.Widget.prototype = {
567567mouseleave : function ( event ) {
568568this . _removeClass ( $ ( event . currentTarget ) , null , "ui-state-hover" ) ;
569569}
570- } ) ;
570+ } ) ;
571571} ,
572572
573573_focusable : function ( element ) {
@@ -579,7 +579,7 @@ $.Widget.prototype = {
579579focusout : function ( event ) {
580580this . _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
608608this . element . trigger ( event , data ) ;
609609return ! ( $ . isFunction ( callback ) &&
610- callback . apply ( this . element [ 0 ] , [ event ] . concat ( data ) ) === false ||
610+ callback . apply ( this . element [ 0 ] , [ event ] . concat ( data ) ) === false ||
611611event . isDefaultPrevented ( ) ) ;
612612}
613613} ;
@@ -637,17 +637,17 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
637637} else if ( effectName !== method && element [ effectName ] ) {
638638element [ effectName ] ( options . duration , options . easing , callback ) ;
639639} else {
640- element . queue ( function ( next ) {
640+ element . queue ( function ( next ) {
641641$ ( this ) [ method ] ( ) ;
642642if ( callback ) {
643643callback . call ( element [ 0 ] ) ;
644644}
645645next ( ) ;
646- } ) ;
646+ } ) ;
647647}
648648} ;
649- } ) ;
649+ } ) ;
650650
651651return $ . widget ;
652652
653- } ) ) ;
653+ } ) ) ;
0 commit comments