app/jquery/jquery-ui.core.js
changeset 2749 4e2789b8e86d
parent 2420 645f4de26f99
--- a/app/jquery/jquery-ui.core.js	Mon Aug 10 16:58:51 2009 -0700
+++ b/app/jquery/jquery-ui.core.js	Tue Aug 11 18:06:57 2009 +0100
@@ -1,21 +1,20 @@
 /*
- * jQuery UI 1.6
+ * jQuery UI 1.7.2
  *
- * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
  * Dual licensed under the MIT (MIT-LICENSE.txt)
  * and GPL (GPL-LICENSE.txt) licenses.
  *
  * http://docs.jquery.com/UI
  */
-;(function($) {
+;jQuery.ui || (function($) {
 
 var _remove = $.fn.remove,
 	isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9);
 
 //Helper functions and ui object
 $.ui = {
-
-	version: "1.6",
+	version: "1.7.2",
 
 	// $.ui.plugin is deprecated.  Use the proxy pattern instead.
 	plugin: {
@@ -28,7 +27,7 @@
 		},
 		call: function(instance, name, args) {
 			var set = instance.plugins[name];
-			if(!set) { return; }
+			if(!set || !instance.element[0].parentNode) { return; }
 
 			for (var i = 0; i < set.length; i++) {
 				if (instance.options[set[i][0]]) {
@@ -39,33 +38,9 @@
 	},
 
 	contains: function(a, b) {
-		var safari2 = $.browser.safari && $.browser.version < 522;
-	    if (a.contains && !safari2) {
-	        return a.contains(b);
-	    }
-	    if (a.compareDocumentPosition)
-	        return !!(a.compareDocumentPosition(b) & 16);
-	    while (b = b.parentNode)
-	          if (b == a) return true;
-	    return false;
-	},
-
-	cssCache: {},
-	css: function(name) {
-		if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; }
-		var tmp = $('<div class="ui-gen">').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body');
-
-		//if (!$.browser.safari)
-			//tmp.appendTo('body');
-
-		//Opera and Safari set width and height to 0px instead of auto
-		//Safari returns rgba(0,0,0,0) when bgcolor is not set
-		$.ui.cssCache[name] = !!(
-			(!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) ||
-			!(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor')))
-		);
-		try { $('body').get(0).removeChild(tmp.get(0));	} catch(e){}
-		return $.ui.cssCache[name];
+		return document.compareDocumentPosition
+			? a.compareDocumentPosition(b) & 16
+			: a !== b && a.contains(b);
 	},
 
 	hasScroll: function(el, a) {
@@ -125,7 +100,6 @@
 		TAB: 9,
 		UP: 38
 	}
-
 };
 
 // WAI-ARIA normalization
@@ -161,7 +135,6 @@
 
 //jQuery plugins
 $.fn.extend({
-
 	remove: function() {
 		// Safari has a native remove event which actually removes DOM elements,
 		// so we have to use triggerHandler instead of trigger (#3037).
@@ -186,7 +159,6 @@
 	},
 
 	scrollParent: function() {
-
 		var scrollParent;
 		if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
 			scrollParent = this.parents().filter(function() {
@@ -199,48 +171,33 @@
 		}
 
 		return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
-
-
 	}
-
 });
 
 
 //Additional selectors
 $.extend($.expr[':'], {
-
-	data: function(a, i, m) {
-		return $.data(a, m[3]);
+	data: function(elem, i, match) {
+		return !!$.data(elem, match[3]);
 	},
 
-	// TODO: add support for object, area
-	tabbable: function(a, i, m) {
-
-		var nodeName = a.nodeName.toLowerCase();
-		function isVisible(element) {
-			return !($(element).is(':hidden') || $(element).parents(':hidden').length);
-		}
-
-		return (
-			// in tab order
-			a.tabIndex >= 0 &&
-
-			( // filter node types that participate in the tab order
+	focusable: function(element) {
+		var nodeName = element.nodeName.toLowerCase(),
+			tabIndex = $.attr(element, 'tabindex');
+		return (/input|select|textarea|button|object/.test(nodeName)
+			? !element.disabled
+			: 'a' == nodeName || 'area' == nodeName
+				? element.href || !isNaN(tabIndex)
+				: !isNaN(tabIndex))
+			// the element and all of its ancestors must be visible
+			// the browser may report that the area is hidden
+			&& !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
+	},
 
-				// anchor tag
-				('a' == nodeName && a.href) ||
-
-				// enabled form element
-				(/input|select|textarea|button/.test(nodeName) &&
-					'hidden' != a.type && !a.disabled)
-			) &&
-
-			// visible on page
-			isVisible(a)
-		);
-
+	tabbable: function(element) {
+		var tabIndex = $.attr(element, 'tabindex');
+		return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable');
 	}
-
 });
 
 
@@ -286,7 +243,7 @@
 
 			// constructor
 			(!instance && !isMethodCall &&
-				$.data(this, name, new $[namespace][name](this, options)));
+				$.data(this, name, new $[namespace][name](this, options))._init());
 
 			// method call
 			(instance && isMethodCall && $.isFunction(instance[options]) &&
@@ -299,6 +256,7 @@
 	$[namespace][name] = function(element, options) {
 		var self = this;
 
+		this.namespace = namespace;
 		this.widgetName = name;
 		this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
 		this.widgetBaseClass = namespace + '-' + name;
@@ -311,16 +269,18 @@
 
 		this.element = $(element)
 			.bind('setData.' + name, function(event, key, value) {
-				return self._setData(key, value);
+				if (event.target == element) {
+					return self._setData(key, value);
+				}
 			})
 			.bind('getData.' + name, function(event, key) {
-				return self._getData(key);
+				if (event.target == element) {
+					return self._getData(key);
+				}
 			})
 			.bind('remove', function() {
 				return self.destroy();
 			});
-
-		this._init();
 	};
 
 	// add widget prototype
@@ -334,7 +294,9 @@
 $.widget.prototype = {
 	_init: function() {},
 	destroy: function() {
-		this.element.removeData(this.widgetName);
+		this.element.removeData(this.widgetName)
+			.removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled')
+			.removeAttr('aria-disabled');
 	},
 
 	option: function(key, value) {
@@ -360,8 +322,11 @@
 		this.options[key] = value;
 
 		if (key == 'disabled') {
-			this.element[value ? 'addClass' : 'removeClass'](
-				this.widgetBaseClass + '-disabled');
+			this.element
+				[value ? 'addClass' : 'removeClass'](
+					this.widgetBaseClass + '-disabled' + ' ' +
+					this.namespace + '-state-disabled')
+				.attr("aria-disabled", value);
 		}
 	},
 
@@ -373,10 +338,27 @@
 	},
 
 	_trigger: function(type, event, data) {
-		var eventName = (type == this.widgetEventPrefix
-			? type : this.widgetEventPrefix + type);
-		event = event || $.event.fix({ type: eventName, target: this.element[0] });
-		return this.element.triggerHandler(eventName, [event, data], this.options[type]);
+		var callback = this.options[type],
+			eventName = (type == this.widgetEventPrefix
+				? type : this.widgetEventPrefix + type);
+
+		event = $.Event(event);
+		event.type = eventName;
+
+		// copy original event properties over to the new event
+		// this would happen if we could call $.event.fix instead of $.Event
+		// but we don't have a way to force an event to be fixed multiple times
+		if (event.originalEvent) {
+			for (var i = $.event.props.length, prop; i;) {
+				prop = $.event.props[--i];
+				event[prop] = event.originalEvent[prop];
+			}
+		}
+
+		this.element.trigger(event, data);
+
+		return !($.isFunction(callback) && callback.call(this.element[0], event, data) === false
+			|| event.isDefaultPrevented());
 	}
 };
 
@@ -398,6 +380,7 @@
 			.bind('click.'+this.widgetName, function(event) {
 				if(self._preventClickEvent) {
 					self._preventClickEvent = false;
+					event.stopImmediatePropagation();
 					return false;
 				}
 			});
@@ -422,6 +405,11 @@
 	},
 
 	_mouseDown: function(event) {
+		// don't let more than one widget handle mouseStart
+		// TODO: figure out why we have to use originalEvent
+		event.originalEvent = event.originalEvent || {};
+		if (event.originalEvent.mouseHandled) { return; }
+
 		// we may have missed mouseup (out of window)
 		(this._mouseStarted && this._mouseUp(event));
 
@@ -463,7 +451,9 @@
 		// preventDefault() is used to prevent the selection of text here -
 		// however, in Safari, this causes select boxes not to be selectable
 		// anymore, so this fix is needed
-		if(!$.browser.safari) event.preventDefault();
+		($.browser.safari || event.preventDefault());
+
+		event.originalEvent.mouseHandled = true;
 		return true;
 	},
 
@@ -494,7 +484,7 @@
 
 		if (this._mouseStarted) {
 			this._mouseStarted = false;
-			this._preventClickEvent = true;
+			this._preventClickEvent = (event.target == this._mouseDownEvent.target);
 			this._mouseStop(event);
 		}