1
1
/*
2
- * jQuery UI Widget 1.9.0 +amd
2
+ * jQuery UI Widget 1.9.1 +amd
3
3
* https://github.com/blueimp/jQuery-File-Upload
4
4
*
5
5
* Copyright 2012 jQuery Foundation and other contributors
@@ -110,7 +110,7 @@ $.widget = function( name, base, prototype ) {
110
110
// TODO: remove support for widgetEventPrefix
111
111
// always use the name + a colon as the prefix, e.g., draggable:start
112
112
// don't prefix for widgets that aren't DOM-based
113
- widgetEventPrefix : name
113
+ widgetEventPrefix : basePrototype . widgetEventPrefix || name
114
114
} , prototype , {
115
115
constructor : constructor ,
116
116
namespace : namespace ,
@@ -151,8 +151,17 @@ $.widget.extend = function( target ) {
151
151
for ( ; inputIndex < inputLength ; inputIndex ++ ) {
152
152
for ( key in input [ inputIndex ] ) {
153
153
value = input [ inputIndex ] [ key ] ;
154
- if ( input [ inputIndex ] . hasOwnProperty ( key ) && value !== undefined ) {
155
- target [ key ] = $ . isPlainObject ( value ) ? $ . widget . extend ( { } , target [ key ] , value ) : value ;
154
+ if ( input [ inputIndex ] . hasOwnProperty ( key ) && value !== undefined ) {
155
+ // Clone objects
156
+ if ( $ . isPlainObject ( value ) ) {
157
+ target [ key ] = $ . isPlainObject ( target [ key ] ) ?
158
+ $ . widget . extend ( { } , target [ key ] , value ) :
159
+ // Don't extend strings, arrays, etc. with objects
160
+ $ . widget . extend ( { } , value ) ;
161
+ // Copy everything else by reference
162
+ } else {
163
+ target [ key ] = value ;
164
+ }
156
165
}
157
166
}
158
167
}
@@ -205,7 +214,7 @@ $.widget.bridge = function( name, object ) {
205
214
} ;
206
215
} ;
207
216
208
- $ . Widget = function ( options , element ) { } ;
217
+ $ . Widget = function ( /* options, element */ ) { } ;
209
218
$ . Widget . _childConstructors = [ ] ;
210
219
211
220
$ . Widget . prototype = {
@@ -237,7 +246,13 @@ $.Widget.prototype = {
237
246
// TODO remove dual storage
238
247
$ . data ( element , this . widgetName , this ) ;
239
248
$ . data ( element , this . widgetFullName , this ) ;
240
- this . _on ( { remove : "destroy" } ) ;
249
+ this . _on ( this . element , {
250
+ remove : function ( event ) {
251
+ if ( event . target === element ) {
252
+ this . destroy ( ) ;
253
+ }
254
+ }
255
+ } ) ;
241
256
this . document = $ ( element . style ?
242
257
// element within the document
243
258
element . ownerDocument :
@@ -356,17 +371,19 @@ $.Widget.prototype = {
356
371
} ,
357
372
358
373
_on : function ( element , handlers ) {
374
+ var delegateElement ,
375
+ instance = this ;
359
376
// no element argument, shuffle and use this.element
360
377
if ( ! handlers ) {
361
378
handlers = element ;
362
379
element = this . element ;
380
+ delegateElement = this . widget ( ) ;
363
381
} else {
364
382
// accept selectors, DOM elements
365
- element = $ ( element ) ;
383
+ element = delegateElement = $ ( element ) ;
366
384
this . bindings = this . bindings . add ( element ) ;
367
385
}
368
386
369
- var instance = this ;
370
387
$ . each ( handlers , function ( event , handler ) {
371
388
function handlerProxy ( ) {
372
389
// allow widgets to customize the disabled handling
@@ -390,7 +407,7 @@ $.Widget.prototype = {
390
407
eventName = match [ 1 ] + instance . eventNamespace ,
391
408
selector = match [ 2 ] ;
392
409
if ( selector ) {
393
- instance . widget ( ) . delegate ( selector , eventName , handlerProxy ) ;
410
+ delegateElement . delegate ( selector , eventName , handlerProxy ) ;
394
411
} else {
395
412
element . bind ( eventName , handlerProxy ) ;
396
413
}
0 commit comments