@@ -40,7 +40,7 @@ $.cleanData = ( function( orig ) {
4040 $ ( elem ) . triggerHandler ( "remove" ) ;
4141 }
4242
43- // http ://bugs.jquery.com/ticket/8235
43+ // Http ://bugs.jquery.com/ticket/8235
4444 } catch ( e ) { }
4545 }
4646 orig ( elems ) ;
@@ -49,7 +49,8 @@ $.cleanData = ( function( orig ) {
4949
5050$ . widget = function ( name , base , prototype ) {
5151 var fullName , existingConstructor , constructor , basePrototype ,
52- // proxiedPrototype allows the provided prototype to remain unmodified
52+
53+ // ProxiedPrototype allows the provided prototype to remain unmodified
5354 // so that it can be used as a mixin for multiple widgets (#8876)
5455 proxiedPrototype = { } ,
5556 namespace = name . split ( "." ) [ 0 ] ;
@@ -66,38 +67,43 @@ $.widget = function( name, base, prototype ) {
6667 prototype = $ . extend . apply ( null , [ { } ] . concat ( prototype ) ) ;
6768 }
6869
69- // create selector for plugin
70+ // Create selector for plugin
7071 $ . expr [ ":" ] [ fullName . toLowerCase ( ) ] = function ( elem ) {
7172 return ! ! $ . data ( elem , fullName ) ;
7273 } ;
7374
7475 $ [ namespace ] = $ [ namespace ] || { } ;
7576 existingConstructor = $ [ namespace ] [ name ] ;
7677 constructor = $ [ namespace ] [ name ] = function ( options , element ) {
77- // allow instantiation without "new" keyword
78+
79+ // Allow instantiation without "new" keyword
7880 if ( ! this . _createWidget ) {
7981 return new constructor ( options , element ) ;
8082 }
8183
82- // allow instantiation without initializing for simple inheritance
84+ // Allow instantiation without initializing for simple inheritance
8385 // must use "new" keyword (the code above always passes args)
8486 if ( arguments . length ) {
8587 this . _createWidget ( options , element ) ;
8688 }
8789 } ;
88- // extend with the existing constructor to carry over any static properties
90+
91+ // Extend with the existing constructor to carry over any static properties
8992 $ . extend ( constructor , existingConstructor , {
9093 version : prototype . version ,
91- // copy the object used to create the prototype in case we need to
94+
95+ // Copy the object used to create the prototype in case we need to
9296 // redefine the widget later
9397 _proto : $ . extend ( { } , prototype ) ,
94- // track widgets that inherit from this widget in case this widget is
98+
99+ // Track widgets that inherit from this widget in case this widget is
95100 // redefined after a widget inherits from it
96101 _childConstructors : [ ]
97102 } ) ;
98103
99104 basePrototype = new base ( ) ;
100- // we need to make the options hash a property directly on the new instance
105+
106+ // We need to make the options hash a property directly on the new instance
101107 // otherwise we'll modify the options hash on the prototype that we're
102108 // inheriting from
103109 basePrototype . options = $ . widget . extend ( { } , basePrototype . options ) ;
@@ -131,6 +137,7 @@ $.widget = function( name, base, prototype ) {
131137 } ) ( ) ;
132138 } ) ;
133139 constructor . prototype = $ . widget . extend ( basePrototype , {
140+
134141 // TODO: remove support for widgetEventPrefix
135142 // always use the name + a colon as the prefix, e.g., draggable:start
136143 // don't prefix for widgets that aren't DOM-based
@@ -150,11 +157,12 @@ $.widget = function( name, base, prototype ) {
150157 $ . each ( existingConstructor . _childConstructors , function ( i , child ) {
151158 var childPrototype = child . prototype ;
152159
153- // redefine the child widget using the same prototype that was
160+ // Redefine the child widget using the same prototype that was
154161 // originally used, but inherit from the new version of the base
155162 $ . widget ( childPrototype . namespace + "." + childPrototype . widgetName , constructor , child . _proto ) ;
156163 } ) ;
157- // remove the list of existing child constructors from the old constructor
164+
165+ // Remove the list of existing child constructors from the old constructor
158166 // so the old child constructors can be garbage collected
159167 delete existingConstructor . _childConstructors ;
160168 } else {
@@ -176,12 +184,15 @@ $.widget.extend = function( target ) {
176184 for ( key in input [ inputIndex ] ) {
177185 value = input [ inputIndex ] [ key ] ;
178186 if ( input [ inputIndex ] . hasOwnProperty ( key ) && value !== undefined ) {
187+
179188 // Clone objects
180189 if ( $ . isPlainObject ( value ) ) {
181190 target [ key ] = $ . isPlainObject ( target [ key ] ) ?
182191 $ . widget . extend ( { } , target [ key ] , value ) :
192+
183193 // Don't extend strings, arrays, etc. with objects
184194 $ . widget . extend ( { } , value ) ;
195+
185196 // Copy everything else by reference
186197 } else {
187198 target [ key ] = value ;
@@ -257,7 +268,7 @@ $.Widget.prototype = {
257268 classes : { } ,
258269 disabled : false ,
259270
260- // callbacks
271+ // Callbacks
261272 create : null
262273 } ,
263274 _createWidget : function ( options , element ) {
@@ -281,9 +292,11 @@ $.Widget.prototype = {
281292 }
282293 } ) ;
283294 this . document = $ ( element . style ?
284- // element within the document
295+
296+ // Element within the document
285297 element . ownerDocument :
286- // element is window or document
298+
299+ // Element is window or document
287300 element . document || element ) ;
288301 this . window = $ ( this . document [ 0 ] . defaultView || this . document [ 0 ] . parentWindow ) ;
289302 }
@@ -310,7 +323,7 @@ $.Widget.prototype = {
310323 that . _removeClass ( value , key ) ;
311324 } ) ;
312325
313- // we can probably remove the unbind calls in 2.0
326+ // We can probably remove the unbind calls in 2.0
314327 // all event bindings should go through this._on()
315328 this . element
316329 . off ( this . eventNamespace )
@@ -319,7 +332,7 @@ $.Widget.prototype = {
319332 . off ( this . eventNamespace )
320333 . removeAttr ( "aria-disabled" ) ;
321334
322- // clean up events and states
335+ // Clean up events and states
323336 this . bindings . off ( this . eventNamespace ) ;
324337 } ,
325338 _destroy : $ . noop ,
@@ -335,12 +348,14 @@ $.Widget.prototype = {
335348 i ;
336349
337350 if ( arguments . length === 0 ) {
338- // don't return a reference to the internal hash
351+
352+ // Don't return a reference to the internal hash
339353 return $ . widget . extend ( { } , this . options ) ;
340354 }
341355
342356 if ( typeof key === "string" ) {
343- // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
357+
358+ // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
344359 options = { } ;
345360 parts = key . split ( "." ) ;
346361 key = parts . shift ( ) ;
@@ -494,14 +509,14 @@ $.Widget.prototype = {
494509 var delegateElement ,
495510 instance = this ;
496511
497- // no suppressDisabledCheck flag, shuffle arguments
512+ // No suppressDisabledCheck flag, shuffle arguments
498513 if ( typeof suppressDisabledCheck !== "boolean" ) {
499514 handlers = element ;
500515 element = suppressDisabledCheck ;
501516 suppressDisabledCheck = false ;
502517 }
503518
504- // no element argument, shuffle and use this.element
519+ // No element argument, shuffle and use this.element
505520 if ( ! handlers ) {
506521 handlers = element ;
507522 element = this . element ;
@@ -513,7 +528,8 @@ $.Widget.prototype = {
513528
514529 $ . each ( handlers , function ( event , handler ) {
515530 function handlerProxy ( ) {
516- // allow widgets to customize the disabled handling
531+
532+ // Allow widgets to customize the disabled handling
517533 // - disabled as an array instead of boolean
518534 // - disabled class as method for disabling individual parts
519535 if ( ! suppressDisabledCheck &&
@@ -525,7 +541,7 @@ $.Widget.prototype = {
525541 . apply ( instance , arguments ) ;
526542 }
527543
528- // copy the guid so direct unbinding works
544+ // Copy the guid so direct unbinding works
529545 if ( typeof handler !== "string" ) {
530546 handlerProxy . guid = handler . guid =
531547 handler . guid || handlerProxy . guid || $ . guid ++ ;
@@ -595,11 +611,12 @@ $.Widget.prototype = {
595611 event . type = ( type === this . widgetEventPrefix ?
596612 type :
597613 this . widgetEventPrefix + type ) . toLowerCase ( ) ;
598- // the original event may come from any element
614+
615+ // The original event may come from any element
599616 // so we need to reset the target on the new event
600617 event . target = this . element [ 0 ] ;
601618
602- // copy original event properties over to the new event
619+ // Copy original event properties over to the new event
603620 orig = event . originalEvent ;
604621 if ( orig ) {
605622 for ( prop in orig ) {
0 commit comments