aboutsummaryrefslogtreecommitdiffstats
path: root/themes/default/js/ui/jquery.ui.widget.js
diff options
context:
space:
mode:
Diffstat (limited to 'themes/default/js/ui/jquery.ui.widget.js')
-rw-r--r--themes/default/js/ui/jquery.ui.widget.js125
1 files changed, 72 insertions, 53 deletions
diff --git a/themes/default/js/ui/jquery.ui.widget.js b/themes/default/js/ui/jquery.ui.widget.js
index ba2ff0264..342313536 100644
--- a/themes/default/js/ui/jquery.ui.widget.js
+++ b/themes/default/js/ui/jquery.ui.widget.js
@@ -1,8 +1,8 @@
/*!
- * jQuery UI Widget 1.9.0
+ * jQuery UI Widget 1.10.1
* http://jqueryui.com
*
- * Copyright 2012 jQuery Foundation and other contributors
+ * Copyright 2013 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
@@ -25,6 +25,9 @@ $.cleanData = function( elems ) {
$.widget = function( name, base, prototype ) {
var fullName, existingConstructor, constructor, basePrototype,
+ // proxiedPrototype allows the provided prototype to remain unmodified
+ // so that it can be used as a mixin for multiple widgets (#8876)
+ proxiedPrototype = {},
namespace = name.split( "." )[ 0 ];
name = name.split( "." )[ 1 ];
@@ -71,43 +74,43 @@ $.widget = function( name, base, prototype ) {
// inheriting from
basePrototype.options = $.widget.extend( {}, basePrototype.options );
$.each( prototype, function( prop, value ) {
- if ( $.isFunction( value ) ) {
- prototype[ prop ] = (function() {
- var _super = function() {
- return base.prototype[ prop ].apply( this, arguments );
- },
- _superApply = function( args ) {
- return base.prototype[ prop ].apply( this, args );
- };
- return function() {
- var __super = this._super,
- __superApply = this._superApply,
- returnValue;
-
- this._super = _super;
- this._superApply = _superApply;
-
- returnValue = value.apply( this, arguments );
-
- this._super = __super;
- this._superApply = __superApply;
-
- return returnValue;
- };
- })();
+ if ( !$.isFunction( value ) ) {
+ proxiedPrototype[ prop ] = value;
+ return;
}
+ proxiedPrototype[ prop ] = (function() {
+ var _super = function() {
+ return base.prototype[ prop ].apply( this, arguments );
+ },
+ _superApply = function( args ) {
+ return base.prototype[ prop ].apply( this, args );
+ };
+ return function() {
+ var __super = this._super,
+ __superApply = this._superApply,
+ returnValue;
+
+ this._super = _super;
+ this._superApply = _superApply;
+
+ returnValue = value.apply( this, arguments );
+
+ this._super = __super;
+ this._superApply = __superApply;
+
+ return returnValue;
+ };
+ })();
});
constructor.prototype = $.widget.extend( basePrototype, {
// TODO: remove support for widgetEventPrefix
// always use the name + a colon as the prefix, e.g., draggable:start
// don't prefix for widgets that aren't DOM-based
- widgetEventPrefix: name
- }, prototype, {
+ widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
+ }, proxiedPrototype, {
constructor: constructor,
namespace: namespace,
widgetName: name,
- // TODO remove widgetBaseClass, see #8155
- widgetBaseClass: fullName,
widgetFullName: fullName
});
@@ -142,8 +145,17 @@ $.widget.extend = function( target ) {
for ( ; inputIndex < inputLength; inputIndex++ ) {
for ( key in input[ inputIndex ] ) {
value = input[ inputIndex ][ key ];
- if (input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
- target[ key ] = $.isPlainObject( value ) ? $.widget.extend( {}, target[ key ], value ) : value;
+ if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
+ // Clone objects
+ if ( $.isPlainObject( value ) ) {
+ target[ key ] = $.isPlainObject( target[ key ] ) ?
+ $.widget.extend( {}, target[ key ], value ) :
+ // Don't extend strings, arrays, etc. with objects
+ $.widget.extend( {}, value );
+ // Copy everything else by reference
+ } else {
+ target[ key ] = value;
+ }
}
}
}
@@ -151,7 +163,7 @@ $.widget.extend = function( target ) {
};
$.widget.bridge = function( name, object ) {
- var fullName = object.prototype.widgetFullName;
+ var fullName = object.prototype.widgetFullName || name;
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string",
args = slice.call( arguments, 1 ),
@@ -187,7 +199,7 @@ $.widget.bridge = function( name, object ) {
if ( instance ) {
instance.option( options || {} )._init();
} else {
- new object( options, this );
+ $.data( this, fullName, new object( options, this ) );
}
});
}
@@ -196,7 +208,7 @@ $.widget.bridge = function( name, object ) {
};
};
-$.Widget = function( options, element ) {};
+$.Widget = function( /* options, element */ ) {};
$.Widget._childConstructors = [];
$.Widget.prototype = {
@@ -224,11 +236,14 @@ $.Widget.prototype = {
this.focusable = $();
if ( element !== this ) {
- // 1.9 BC for #7810
- // TODO remove dual storage
- $.data( element, this.widgetName, this );
$.data( element, this.widgetFullName, this );
- this._on({ remove: "destroy" });
+ this._on( true, this.element, {
+ remove: function( event ) {
+ if ( event.target === element ) {
+ this.destroy();
+ }
+ }
+ });
this.document = $( element.style ?
// element within the document
element.ownerDocument :
@@ -346,25 +361,36 @@ $.Widget.prototype = {
return this._setOption( "disabled", true );
},
- _on: function( element, handlers ) {
+ _on: function( suppressDisabledCheck, element, handlers ) {
+ var delegateElement,
+ instance = this;
+
+ // no suppressDisabledCheck flag, shuffle arguments
+ if ( typeof suppressDisabledCheck !== "boolean" ) {
+ handlers = element;
+ element = suppressDisabledCheck;
+ suppressDisabledCheck = false;
+ }
+
// no element argument, shuffle and use this.element
if ( !handlers ) {
handlers = element;
element = this.element;
+ delegateElement = this.widget();
} else {
// accept selectors, DOM elements
- element = $( element );
+ element = delegateElement = $( element );
this.bindings = this.bindings.add( element );
}
- var instance = this;
$.each( handlers, function( event, handler ) {
function handlerProxy() {
// allow widgets to customize the disabled handling
// - disabled as an array instead of boolean
// - disabled class as method for disabling individual parts
- if ( instance.options.disabled === true ||
- $( this ).hasClass( "ui-state-disabled" ) ) {
+ if ( !suppressDisabledCheck &&
+ ( instance.options.disabled === true ||
+ $( this ).hasClass( "ui-state-disabled" ) ) ) {
return;
}
return ( typeof handler === "string" ? instance[ handler ] : handler )
@@ -381,7 +407,7 @@ $.Widget.prototype = {
eventName = match[1] + instance.eventNamespace,
selector = match[2];
if ( selector ) {
- instance.widget().delegate( selector, eventName, handlerProxy );
+ delegateElement.delegate( selector, eventName, handlerProxy );
} else {
element.bind( eventName, handlerProxy );
}
@@ -476,7 +502,7 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
if ( options.delay ) {
element.delay( options.delay );
}
- if ( hasOptions && $.effects && ( $.effects.effect[ effectName ] || $.uiBackCompat !== false && $.effects[ effectName ] ) ) {
+ if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
element[ method ]( options );
} else if ( effectName !== method && element[ effectName ] ) {
element[ effectName ]( options.duration, options.easing, callback );
@@ -492,11 +518,4 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
};
});
-// DEPRECATED
-if ( $.uiBackCompat !== false ) {
- $.Widget.prototype._getCreateOptions = function() {
- return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
- };
-}
-
})( jQuery );