Skip to content

Commit 88f4653

Browse files
committed
Updated jQuery UI Widget Factory to version 1.9.1.
1 parent 48ba2c6 commit 88f4653

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

js/vendor/jquery.ui.widget.js

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery UI Widget 1.9.0+amd
2+
* jQuery UI Widget 1.9.1+amd
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2012 jQuery Foundation and other contributors
@@ -110,7 +110,7 @@ $.widget = function( name, base, prototype ) {
110110
// TODO: remove support for widgetEventPrefix
111111
// always use the name + a colon as the prefix, e.g., draggable:start
112112
// don't prefix for widgets that aren't DOM-based
113-
widgetEventPrefix: name
113+
widgetEventPrefix: basePrototype.widgetEventPrefix || name
114114
}, prototype, {
115115
constructor: constructor,
116116
namespace: namespace,
@@ -151,8 +151,17 @@ $.widget.extend = function( target ) {
151151
for ( ; inputIndex < inputLength; inputIndex++ ) {
152152
for ( key in input[ inputIndex ] ) {
153153
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+
}
156165
}
157166
}
158167
}
@@ -205,7 +214,7 @@ $.widget.bridge = function( name, object ) {
205214
};
206215
};
207216

208-
$.Widget = function( options, element ) {};
217+
$.Widget = function( /* options, element */ ) {};
209218
$.Widget._childConstructors = [];
210219

211220
$.Widget.prototype = {
@@ -237,7 +246,13 @@ $.Widget.prototype = {
237246
// TODO remove dual storage
238247
$.data( element, this.widgetName, this );
239248
$.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+
});
241256
this.document = $( element.style ?
242257
// element within the document
243258
element.ownerDocument :
@@ -356,17 +371,19 @@ $.Widget.prototype = {
356371
},
357372

358373
_on: function( element, handlers ) {
374+
var delegateElement,
375+
instance = this;
359376
// no element argument, shuffle and use this.element
360377
if ( !handlers ) {
361378
handlers = element;
362379
element = this.element;
380+
delegateElement = this.widget();
363381
} else {
364382
// accept selectors, DOM elements
365-
element = $( element );
383+
element = delegateElement = $( element );
366384
this.bindings = this.bindings.add( element );
367385
}
368386

369-
var instance = this;
370387
$.each( handlers, function( event, handler ) {
371388
function handlerProxy() {
372389
// allow widgets to customize the disabled handling
@@ -390,7 +407,7 @@ $.Widget.prototype = {
390407
eventName = match[1] + instance.eventNamespace,
391408
selector = match[2];
392409
if ( selector ) {
393-
instance.widget().delegate( selector, eventName, handlerProxy );
410+
delegateElement.delegate( selector, eventName, handlerProxy );
394411
} else {
395412
element.bind( eventName, handlerProxy );
396413
}

0 commit comments

Comments
 (0)