You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jd...@apache.org on 2010/12/30 12:53:40 UTC
svn commit: r1053863 [5/9] - in /wicket/trunk/wicket-datetime/src:
main/java/org/apache/wicket/extensions/yui/
main/java/org/apache/wicket/extensions/yui/calendar/
main/java/org/apache/wicket/extensions/yui/calendar/assets/skins/sam/
main/java/org/apac...
Modified: wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/event/event.js
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/event/event.js?rev=1053863&r1=1053862&r2=1053863&view=diff
==============================================================================
--- wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/event/event.js (original)
+++ wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/event/event.js Thu Dec 30 11:53:40 2010
@@ -1,8 +1,8 @@
/*
-Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 2.7.0
+http://developer.yahoo.com/yui/license.html
+version: 2.8.2r1
*/
/**
@@ -20,11 +20,15 @@ version: 2.7.0
* will receive. YAHOO.util.CustomEvent.LIST or
* YAHOO.util.CustomEvent.FLAT. The default is
* YAHOO.util.CustomEvent.LIST.
+ * @param fireOnce {boolean} If configured to fire once, the custom event
+ * will only notify subscribers a single time regardless of how many times
+ * the event is fired. In addition, new subscribers will be notified
+ * immediately if the event has already been fired.
* @namespace YAHOO.util
* @class CustomEvent
* @constructor
*/
-YAHOO.util.CustomEvent = function(type, context, silent, signature) {
+YAHOO.util.CustomEvent = function(type, context, silent, signature, fireOnce) {
/**
* The type of event, returned to subscribers when the event fires
@@ -34,22 +38,48 @@ YAHOO.util.CustomEvent = function(type,
this.type = type;
/**
- * The context the the event will fire from by default. Defaults to the window
- * obj
+ * The context the event will fire from by default. Defaults to the window obj.
* @property scope
* @type object
*/
this.scope = context || window;
/**
- * By default all custom events are logged in the debug build, set silent
- * to true to disable debug outpu for this event.
+ * By default all custom events are logged in the debug build. Set silent to true
+ * to disable debug output for this event.
* @property silent
* @type boolean
*/
this.silent = silent;
/**
+ * If configured to fire once, the custom event will only notify subscribers
+ * a single time regardless of how many times the event is fired. In addition,
+ * new subscribers will be notified immediately if the event has already been
+ * fired.
+ * @property fireOnce
+ * @type boolean
+ * @default false
+ */
+ this.fireOnce = fireOnce;
+
+ /**
+ * Indicates whether or not this event has ever been fired.
+ * @property fired
+ * @type boolean
+ * @default false
+ */
+ this.fired = false;
+
+ /**
+ * For fireOnce events the arguments the event was fired with are stored
+ * so that new subscribers get the proper payload.
+ * @property firedWith
+ * @type Array
+ */
+ this.firedWith = null;
+
+ /**
* Custom events support two styles of arguments provided to the event
* subscribers.
* <ul>
@@ -97,14 +127,12 @@ YAHOO.util.CustomEvent = function(type,
*
* @event subscribeEvent
* @type YAHOO.util.CustomEvent
- * @param {Function} fn The function to execute
- * @param {Object} obj An object to be passed along when the event
- * fires defaults to the custom event
- * @param {boolean|Object} override If true, the obj passed in becomes
- * the execution context of the listener.
- * if an object, that object becomes the
- * the execution context. defaults to
- * the custom event
+ * @param fn {Function} The function to execute
+ * @param obj <Object> An object to be passed along when the event fires.
+ * Defaults to the custom event.
+ * @param override <boolean|Object> If true, the obj passed in becomes the
+ * execution context of the listener. If an object, that object becomes
+ * the execution context. Defaults to the custom event.
*/
this.subscribeEvent =
new YAHOO.util.CustomEvent(onsubscribeType, this, true);
@@ -148,12 +176,9 @@ YAHOO.util.CustomEvent.prototype = {
* Subscribes the caller to this event
* @method subscribe
* @param {Function} fn The function to execute
- * @param {Object} obj An object to be passed along when the event
- * fires
- * @param {boolean|Object} overrideContext If true, the obj passed in becomes
- * the execution context of the listener.
- * if an object, that object becomes the
- * the execution context.
+ * @param {Object} obj An object to be passed along when the event fires.
+ * overrideContext <boolean|Object> If true, the obj passed in becomes the execution
+ * context of the listener. If an object, that object becomes the execution context.
*/
subscribe: function(fn, obj, overrideContext) {
@@ -165,7 +190,13 @@ throw new Error("Invalid callback for su
this.subscribeEvent.fire(fn, obj, overrideContext);
}
- this.subscribers.push( new YAHOO.util.Subscriber(fn, obj, overrideContext) );
+ var s = new YAHOO.util.Subscriber(fn, obj, overrideContext);
+
+ if (this.fireOnce && this.fired) {
+ this.notify(s, this.firedWith);
+ } else {
+ this.subscribers.push(s);
+ }
},
/**
@@ -221,61 +252,43 @@ throw new Error("Invalid callback for su
var errors = [],
len=this.subscribers.length;
+
+ var args=[].slice.call(arguments, 0), ret=true, i, rebuild=false;
+
+ if (this.fireOnce) {
+ if (this.fired) {
+ return true;
+ } else {
+ this.firedWith = args;
+ }
+ }
+
+ this.fired = true;
+
if (!len && this.silent) {
return true;
}
- var args=[].slice.call(arguments, 0), ret=true, i, rebuild=false;
-
if (!this.silent) {
}
// make a copy of the subscribers so that there are
// no index problems if one subscriber removes another.
- var subs = this.subscribers.slice(), throwErrors = YAHOO.util.Event.throwErrors;
+ var subs = this.subscribers.slice();
for (i=0; i<len; ++i) {
var s = subs[i];
if (!s) {
rebuild=true;
} else {
- if (!this.silent) {
- }
-
- var scope = s.getScope(this.scope);
-
- if (this.signature == YAHOO.util.CustomEvent.FLAT) {
- var param = null;
- if (args.length > 0) {
- param = args[0];
- }
- try {
- ret = s.fn.call(scope, param, s.obj);
- } catch(e) {
- this.lastError = e;
- // errors.push(e);
- if (throwErrors) {
- throw e;
- }
- }
- } else {
- try {
- ret = s.fn.call(scope, this.type, args, s.obj);
- } catch(ex) {
- this.lastError = ex;
- if (throwErrors) {
- throw ex;
- }
- }
- }
+ ret = this.notify(s, args);
if (false === ret) {
if (!this.silent) {
}
break;
- // return false;
}
}
}
@@ -283,6 +296,43 @@ throw new Error("Invalid callback for su
return (ret !== false);
},
+ notify: function(s, args) {
+
+ var ret, param=null, scope = s.getScope(this.scope),
+ throwErrors = YAHOO.util.Event.throwErrors;
+
+ if (!this.silent) {
+ }
+
+ if (this.signature == YAHOO.util.CustomEvent.FLAT) {
+
+ if (args.length > 0) {
+ param = args[0];
+ }
+
+ try {
+ ret = s.fn.call(scope, param, s.obj);
+ } catch(e) {
+ this.lastError = e;
+ // errors.push(e);
+ if (throwErrors) {
+ throw e;
+ }
+ }
+ } else {
+ try {
+ ret = s.fn.call(scope, this.type, args, s.obj);
+ } catch(ex) {
+ this.lastError = ex;
+ if (throwErrors) {
+ throw ex;
+ }
+ }
+ }
+
+ return ret;
+ },
+
/**
* Removes all listeners
* @method unsubscribeAll
@@ -443,7 +493,7 @@ if (!YAHOO.util.Event) {
* @static
* @private
*/
- var loadComplete = false;
+ var loadComplete = false,
/**
* Cache of wrapped listeners
@@ -452,7 +502,8 @@ if (!YAHOO.util.Event) {
* @static
* @private
*/
- var listeners = [];
+ listeners = [],
+
/**
* User-defined unload function that will be fired before all events
@@ -462,24 +513,7 @@ if (!YAHOO.util.Event) {
* @static
* @private
*/
- var unloadListeners = [];
-
- /**
- * Cache of DOM0 event handlers to work around issues with DOM2 events
- * in Safari
- * @property legacyEvents
- * @static
- * @private
- */
- var legacyEvents = [];
-
- /**
- * Listener stack for DOM0 events
- * @property legacyHandlers
- * @static
- * @private
- */
- var legacyHandlers = [];
+ unloadListeners = [],
/**
* The number of times to poll after window.onload. This number is
@@ -489,7 +523,7 @@ if (!YAHOO.util.Event) {
* @static
* @private
*/
- var retryCount = 0;
+ retryCount = 0,
/**
* onAvailable listeners
@@ -497,15 +531,7 @@ if (!YAHOO.util.Event) {
* @static
* @private
*/
- var onAvailStack = [];
-
- /**
- * Lookup table for legacy events
- * @property legacyMap
- * @static
- * @private
- */
- var legacyMap = [];
+ onAvailStack = [],
/**
* Counter for auto id generation
@@ -513,7 +539,7 @@ if (!YAHOO.util.Event) {
* @static
* @private
*/
- var counter = 0;
+ counter = 0,
/**
* Normalized keycodes for webkit/safari
@@ -523,7 +549,7 @@ if (!YAHOO.util.Event) {
* @static
* @final
*/
- var webkitKeymap = {
+ webkitKeymap = {
63232: 38, // up
63233: 40, // down
63234: 37, // left
@@ -532,26 +558,29 @@ if (!YAHOO.util.Event) {
63277: 34, // page down
25: 9 // SHIFT-TAB (Safari provides a different key code in
// this case, even though the shiftKey modifier is set)
- };
-
+ },
+
+ isIE = YAHOO.env.ua.ie,
+
// String constants used by the addFocusListener and removeFocusListener methods
- var _FOCUS = YAHOO.env.ua.ie ? "focusin" : "focus";
- var _BLUR = YAHOO.env.ua.ie ? "focusout" : "blur";
+
+ FOCUSIN = "focusin",
+ FOCUSOUT = "focusout";
return {
/**
* The number of times we should look for elements that are not
* in the DOM at the time the event is requested after the document
- * has been loaded. The default is 2000@amp;20 ms, so it will poll
- * for 40 seconds or until all outstanding handlers are bound
+ * has been loaded. The default is 500@amp;40 ms, so it will poll
+ * for 20 seconds or until all outstanding handlers are bound
* (whichever comes first).
* @property POLL_RETRYS
* @type int
* @static
* @final
*/
- POLL_RETRYS: 2000,
+ POLL_RETRYS: 500,
/**
* The poll interval in milliseconds
@@ -560,7 +589,7 @@ if (!YAHOO.util.Event) {
* @static
* @final
*/
- POLL_INTERVAL: 20,
+ POLL_INTERVAL: 40,
/**
* Element to bind, int constant
@@ -638,6 +667,15 @@ if (!YAHOO.util.Event) {
OVERRIDE: 6,
/**
+ * The original capture parameter passed into addListener
+ * @property CAPTURE
+ * @type int
+ * @static
+ * @final
+ */
+ CAPTURE: 7,
+
+ /**
* addListener/removeListener can throw errors in unexpected scenarios.
* These errors are suppressed, the method returns false, and this property
* is set
@@ -673,7 +711,7 @@ if (!YAHOO.util.Event) {
* @static
* @deprecated use YAHOO.env.ua.ie
*/
- isIE: YAHOO.env.ua.ie,
+ isIE: isIE,
/**
* poll handle
@@ -691,6 +729,19 @@ if (!YAHOO.util.Event) {
*/
_dri: null,
+
+ /**
+ * Map of special event types
+ * @property _specialTypes
+ * @static
+ * @private
+ */
+ _specialTypes: {
+ focusin: (isIE ? "focusin" : "focus"),
+ focusout: (isIE ? "focusout" : "blur")
+ },
+
+
/**
* True when the document is initially usable
* @property DOMReady
@@ -710,6 +761,7 @@ if (!YAHOO.util.Event) {
*/
throwErrors: false,
+
/**
* @method startInterval
* @static
@@ -717,9 +769,10 @@ if (!YAHOO.util.Event) {
*/
startInterval: function() {
if (!this._interval) {
- var self = this;
- var callback = function() { self._tryPreloadAttach(); };
- this._interval = setInterval(callback, this.POLL_INTERVAL);
+ // var self = this;
+ // var callback = function() { self._tryPreloadAttach(); };
+ // this._interval = setInterval(callback, this.POLL_INTERVAL);
+ this._interval = YAHOO.lang.later(this.POLL_INTERVAL, this, this._tryPreloadAttach, null, true);
}
},
@@ -820,22 +873,9 @@ if (!YAHOO.util.Event) {
*
* @static
*/
- onDOMReady: function(fn, obj, overrideContext) {
- if (this.DOMReady) {
- setTimeout(function() {
- var s = window;
- if (overrideContext) {
- if (overrideContext === true) {
- s = obj;
- } else {
- s = overrideContext;
- }
- }
- fn.call(s, "DOMReady", [], obj);
- }, 0);
- } else {
- this.DOMReadyEvent.subscribe(fn, obj, overrideContext);
- }
+ // onDOMReady: function(fn, obj, overrideContext) {
+ onDOMReady: function() {
+ this.DOMReadyEvent.subscribe.apply(this.DOMReadyEvent, arguments);
},
@@ -895,7 +935,7 @@ if (!YAHOO.util.Event) {
} else {
// defer adding the event until the element is available
this.onAvailable(el, function() {
- YAHOO.util.Event.on(el, sType, fn, obj, overrideContext);
+ YAHOO.util.Event._addListener(el, sType, fn, obj, overrideContext, bCapture);
});
return true;
@@ -938,56 +978,41 @@ if (!YAHOO.util.Event) {
obj);
};
- var li = [el, sType, fn, wrappedFn, context, obj, overrideContext];
+ var li = [el, sType, fn, wrappedFn, context, obj, overrideContext, bCapture];
var index = listeners.length;
// cache the listener so we can try to automatically unload
listeners[index] = li;
- if (this.useLegacyEvent(el, sType)) {
- var legacyIndex = this.getLegacyIndex(el, sType);
-
- // Add a new dom0 wrapper if one is not detected for this
- // element
- if ( legacyIndex == -1 ||
- el != legacyEvents[legacyIndex][0] ) {
-
- legacyIndex = legacyEvents.length;
- legacyMap[el.id + sType] = legacyIndex;
-
- // cache the signature for the DOM0 event, and
- // include the existing handler for the event, if any
- legacyEvents[legacyIndex] =
- [el, sType, el["on" + sType]];
- legacyHandlers[legacyIndex] = [];
-
- el["on" + sType] =
- function(e) {
- YAHOO.util.Event.fireLegacyEvent(
- YAHOO.util.Event.getEvent(e), legacyIndex);
- };
- }
-
- // add a reference to the wrapped listener to our custom
- // stack of events
- //legacyHandlers[legacyIndex].push(index);
- legacyHandlers[legacyIndex].push(li);
-
- } else {
- try {
- this._simpleAdd(el, sType, wrappedFn, bCapture);
- } catch(ex) {
- // handle an error trying to attach an event. If it fails
- // we need to clean up the cache
- this.lastError = ex;
- this.removeListener(el, sType, fn);
- return false;
- }
+ try {
+ this._simpleAdd(el, sType, wrappedFn, bCapture);
+ } catch(ex) {
+ // handle an error trying to attach an event. If it fails
+ // we need to clean up the cache
+ this.lastError = ex;
+ this.removeListener(el, sType, fn);
+ return false;
}
return true;
},
+ /**
+ * Checks to see if the type requested is a special type
+ * (as defined by the _specialTypes hash), and (if so) returns
+ * the special type name.
+ *
+ * @method _getType
+ *
+ * @param {String} sType The type to look up
+ * @private
+ */
+ _getType: function (type) {
+
+ return this._specialTypes[type] || type;
+
+ },
+
/**
* Appends an event handler
@@ -1012,13 +1037,18 @@ if (!YAHOO.util.Event) {
* @static
*/
addListener: function (el, sType, fn, obj, overrideContext) {
- return this._addListener(el, sType, fn, obj, overrideContext, false);
- },
+
+ var capture = ((sType == FOCUSIN || sType == FOCUSOUT) && !YAHOO.env.ua.ie) ? true : false;
+
+ return this._addListener(el, this._getType(sType), fn, obj, overrideContext, capture);
+
+ },
+
/**
- * Appends a focus event handler. (The focusin event is used for Internet Explorer,
- * the focus, capture-event for Opera, WebKit.)
- *
+ * Attaches a focusin event listener to the specified element for
+ * the purpose of listening for the focus event on the element's
+ * descendants.
* @method addFocusListener
*
* @param {String|HTMLElement|Array|NodeList} el An id, an element
@@ -1036,16 +1066,19 @@ if (!YAHOO.util.Event) {
* could not have the listener attached,
* or if the operation throws an exception.
* @static
+ * @deprecated use YAHOO.util.Event.on and specify "focusin" as the event type.
*/
addFocusListener: function (el, fn, obj, overrideContext) {
- return this._addListener(el, _FOCUS, fn, obj, overrideContext, true);
+ return this.on(el, FOCUSIN, fn, obj, overrideContext);
},
/**
- * Removes a focus event listener
+ * Removes a focusin event listener to the specified element for
+ * the purpose of listening for the focus event on the element's
+ * descendants.
*
- * @method removeListener
+ * @method removeFocusListener
*
* @param {String|HTMLElement|Array|NodeList} el An id, an element
* reference, or a collection of ids and/or elements to remove
@@ -1056,14 +1089,16 @@ if (!YAHOO.util.Event) {
* @return {boolean} true if the unbind was successful, false
* otherwise.
* @static
+ * @deprecated use YAHOO.util.Event.removeListener and specify "focusin" as the event type.
*/
removeFocusListener: function (el, fn) {
- return this.removeListener(el, _FOCUS, fn);
+ return this.removeListener(el, FOCUSIN, fn);
},
/**
- * Appends a blur event handler. (The focusout event is used for Internet Explorer,
- * the focusout, capture-event for Opera, WebKit.)
+ * Attaches a focusout event listener to the specified element for
+ * the purpose of listening for the blur event on the element's
+ * descendants.
*
* @method addBlurListener
*
@@ -1082,15 +1117,18 @@ if (!YAHOO.util.Event) {
* could not have the listener attached,
* or if the operation throws an exception.
* @static
+ * @deprecated use YAHOO.util.Event.on and specify "focusout" as the event type.
*/
addBlurListener: function (el, fn, obj, overrideContext) {
- return this._addListener(el, _BLUR, fn, obj, overrideContext, true);
+ return this.on(el, FOCUSOUT, fn, obj, overrideContext);
},
/**
- * Removes a blur event listener
+ * Removes a focusout event listener to the specified element for
+ * the purpose of listening for the blur event on the element's
+ * descendants.
*
- * @method removeListener
+ * @method removeBlurListener
*
* @param {String|HTMLElement|Array|NodeList} el An id, an element
* reference, or a collection of ids and/or elements to remove
@@ -1101,75 +1139,13 @@ if (!YAHOO.util.Event) {
* @return {boolean} true if the unbind was successful, false
* otherwise.
* @static
+ * @deprecated use YAHOO.util.Event.removeListener and specify "focusout" as the event type.
*/
removeBlurListener: function (el, fn) {
-
- return this.removeListener(el, _BLUR, fn);
-
- },
-
- /**
- * When using legacy events, the handler is routed to this object
- * so we can fire our custom listener stack.
- * @method fireLegacyEvent
- * @static
- * @private
- */
- fireLegacyEvent: function(e, legacyIndex) {
- var ok=true, le, lh, li, context, ret;
-
- lh = legacyHandlers[legacyIndex].slice();
- for (var i=0, len=lh.length; i<len; ++i) {
- // for (var i in lh.length) {
- li = lh[i];
- if ( li && li[this.WFN] ) {
- context = li[this.ADJ_SCOPE];
- ret = li[this.WFN].call(context, e);
- ok = (ok && ret);
- }
- }
-
- // Fire the original handler if we replaced one. We fire this
- // after the other events to keep stopPropagation/preventDefault
- // that happened in the DOM0 handler from touching our DOM2
- // substitute
- le = legacyEvents[legacyIndex];
- if (le && le[2]) {
- le[2](e);
- }
-
- return ok;
+ return this.removeListener(el, FOCUSOUT, fn);
},
/**
- * Returns the legacy event index that matches the supplied
- * signature
- * @method getLegacyIndex
- * @static
- * @private
- */
- getLegacyIndex: function(el, sType) {
- var key = this.generateId(el) + sType;
- if (typeof legacyMap[key] == "undefined") {
- return -1;
- } else {
- return legacyMap[key];
- }
- },
-
- /**
- * Logic that determines when we should automatically use legacy
- * events instead of DOM2 events. Currently this is limited to old
- * Safari browsers with a broken preventDefault
- * @method useLegacyEvent
- * @static
- * @private
- */
- useLegacyEvent: function(el, sType) {
-return (this.webkit && this.webkit < 419 && ("click"==sType || "dblclick"==sType));
- },
-
- /**
* Removes an event listener
*
* @method removeListener
@@ -1188,6 +1164,8 @@ return (this.webkit && this.webkit < 419
removeListener: function(el, sType, fn) {
var i, len, li;
+ sType = this._getType(sType);
+
// The el argument can be a string
if (typeof el == "string") {
el = this.getEl(el);
@@ -1230,7 +1208,7 @@ return (this.webkit && this.webkit < 419
var index = arguments[3];
if ("undefined" === typeof index) {
- index = this._getCacheIndex(el, sType, fn);
+ index = this._getCacheIndex(listeners, el, sType, fn);
}
if (index >= 0) {
@@ -1242,31 +1220,13 @@ return (this.webkit && this.webkit < 419
}
- if (this.useLegacyEvent(el, sType)) {
- var legacyIndex = this.getLegacyIndex(el, sType);
- var llist = legacyHandlers[legacyIndex];
- if (llist) {
- for (i=0, len=llist.length; i<len; ++i) {
- // for (i in llist.length) {
- li = llist[i];
- if (li &&
- li[this.EL] == el &&
- li[this.TYPE] == sType &&
- li[this.FN] == fn) {
- llist.splice(i, 1);
- // llist[i]=null;
- break;
- }
- }
- }
+ var bCapture = cacheItem[this.CAPTURE] === true ? true : false;
- } else {
- try {
- this._simpleRemove(el, sType, cacheItem[this.WFN], false);
- } catch(ex) {
- this.lastError = ex;
- return false;
- }
+ try {
+ this._simpleRemove(el, sType, cacheItem[this.WFN], bCapture);
+ } catch(ex) {
+ this.lastError = ex;
+ return false;
}
// removed the wrapped handler
@@ -1502,9 +1462,9 @@ return (this.webkit && this.webkit < 419
* @static
* @private
*/
- _getCacheIndex: function(el, sType, fn) {
- for (var i=0, l=listeners.length; i<l; i=i+1) {
- var li = listeners[i];
+ _getCacheIndex: function(a, el, sType, fn) {
+ for (var i=0, l=a.length; i<l; i=i+1) {
+ var li = a[i];
if ( li &&
li[this.FN] == fn &&
li[this.EL] == el &&
@@ -1598,7 +1558,7 @@ return (this.webkit && this.webkit < 419
* Custom event the fires when the dom is initially usable
* @event DOMReadyEvent
*/
- DOMReadyEvent: new YAHOO.util.CustomEvent("DOMReady", this),
+ DOMReadyEvent: new YAHOO.util.CustomEvent("DOMReady", YAHOO, 0, 0, 1),
/**
* hook up any deferred listeners
@@ -1657,7 +1617,8 @@ return (this.webkit && this.webkit < 419
if (onAvailStack.length === 0) {
retryCount = 0;
if (this._interval) {
- clearInterval(this._interval);
+ // clearInterval(this._interval);
+ this._interval.cancel();
this._interval = null;
}
return;
@@ -1747,7 +1708,8 @@ return (this.webkit && this.webkit < 419
this.startInterval();
} else {
if (this._interval) {
- clearInterval(this._interval);
+ // clearInterval(this._interval);
+ this._interval.cancel();
this._interval = null;
}
}
@@ -1808,6 +1770,7 @@ return (this.webkit && this.webkit < 419
} else if (sType === "unload") {
searchLists = [unloadListeners];
} else {
+ sType = this._getType(sType);
searchLists = [listeners];
}
@@ -1870,8 +1833,6 @@ return (this.webkit && this.webkit < 419
unloadListeners = null;
// Remove listeners to handle IE memory leaks
- //if (YAHOO.env.ua.ie && listeners && listeners.length > 0) {
-
// 2.5.0 listeners are removed for all browsers again. FireFox preserves
// at least some listeners between page refreshes, potentially causing
// errors during page load (mouseover listeners firing before they
@@ -1886,8 +1847,6 @@ return (this.webkit && this.webkit < 419
l=null;
}
- legacyEvents = null;
-
EU._simpleRemove(window, "unload", EU._unload);
},
@@ -1938,9 +1897,7 @@ return (this.webkit && this.webkit < 419
* @static
* @deprecated still here for backwards compatibility
*/
- regCE: function() {
- // does nothing
- },
+ regCE: function() {},
/**
* Adds a DOM event directly without the caching, cleanup, context adj, etc
@@ -2008,9 +1965,10 @@ return (this.webkit && this.webkit < 419
/**
* YAHOO.util.Event.onFocus is an alias for addFocusListener
- * @method on
+ * @method onFocus
* @see addFocusListener
* @static
+ * @deprecated use YAHOO.util.Event.on and specify "focusin" as the event type.
*/
EU.onFocus = EU.addFocusListener;
@@ -2019,39 +1977,47 @@ return (this.webkit && this.webkit < 419
* @method onBlur
* @see addBlurListener
* @static
+ * @deprecated use YAHOO.util.Event.on and specify "focusout" as the event type.
*/
EU.onBlur = EU.addBlurListener;
-
-/*! DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller */
+/*! DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller/Diego Perini */
// Internet Explorer: use the readyState of a defered script.
// This isolates what appears to be a safe moment to manipulate
// the DOM prior to when the document's readyState suggests
// it is safe to do so.
if (EU.isIE) {
+ if (self !== self.top) {
+ document.onreadystatechange = function() {
+ if (document.readyState == 'complete') {
+ document.onreadystatechange = null;
+ EU._ready();
+ }
+ };
+ } else {
- // Process onAvailable/onContentReady items when the
- // DOM is ready.
- YAHOO.util.Event.onDOMReady(
- YAHOO.util.Event._tryPreloadAttach,
- YAHOO.util.Event, true);
-
- var n = document.createElement('p');
+ // Process onAvailable/onContentReady items when the
+ // DOM is ready.
+ YAHOO.util.Event.onDOMReady(
+ YAHOO.util.Event._tryPreloadAttach,
+ YAHOO.util.Event, true);
+
+ var n = document.createElement('p');
- EU._dri = setInterval(function() {
- try {
- // throws an error if doc is not ready
- n.doScroll('left');
- clearInterval(EU._dri);
- EU._dri = null;
- EU._ready();
- n = null;
- } catch (ex) {
- }
- }, EU.POLL_INTERVAL);
+ EU._dri = setInterval(function() {
+ try {
+ // throws an error if doc is not ready
+ n.doScroll('left');
+ clearInterval(EU._dri);
+ EU._dri = null;
+ EU._ready();
+ n = null;
+ } catch (ex) {
+ }
+ }, EU.POLL_INTERVAL);
+ }
-
// The document's readyState in Safari currently will
// change to loaded/complete before images are loaded.
} else if (EU.webkit && EU.webkit < 525) {
@@ -2206,6 +2172,13 @@ YAHOO.util.EventProvider.prototype = {
* This is false by default.
* </li>
* <li>
+ * fireOnce: if true, the custom event will only notify subscribers
+ * once regardless of the number of times the event is fired. In
+ * addition, new subscribers will be executed immediately if the
+ * event has already fired.
+ * This is false by default.
+ * </li>
+ * <li>
* onSubscribeCallback: specifies a callback to execute when the
* event has a new subscriber. This will fire immediately for
* each queued subscriber if any exist prior to the creation of
@@ -2219,17 +2192,15 @@ YAHOO.util.EventProvider.prototype = {
createEvent: function(p_type, p_config) {
this.__yui_events = this.__yui_events || {};
- var opts = p_config || {};
- var events = this.__yui_events;
+ var opts = p_config || {},
+ events = this.__yui_events, ce;
if (events[p_type]) {
} else {
- var scope = opts.scope || this;
- var silent = (opts.silent);
+ ce = new YAHOO.util.CustomEvent(p_type, opts.scope || this, opts.silent,
+ YAHOO.util.CustomEvent.FLAT, opts.fireOnce);
- var ce = new YAHOO.util.CustomEvent(p_type, scope, silent,
- YAHOO.util.CustomEvent.FLAT);
events[p_type] = ce;
if (opts.onSubscribeCallback) {
@@ -2266,7 +2237,7 @@ YAHOO.util.EventProvider.prototype = {
* @return {boolean} the return value from CustomEvent.fire
*
*/
- fireEvent: function(p_type, arg1, arg2, etc) {
+ fireEvent: function(p_type) {
this.__yui_events = this.__yui_events || {};
var ce = this.__yui_events[p_type];
@@ -2526,4 +2497,4 @@ KeyListener.KEY = {
};
})();
-YAHOO.register("event", YAHOO.util.Event, {version: "2.7.0", build: "1799"});
+YAHOO.register("event", YAHOO.util.Event, {version: "2.8.2r1", build: "7"});
Modified: wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo-min.js
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo-min.js?rev=1053863&r1=1053862&r2=1053863&view=diff
==============================================================================
--- wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo-min.js (original)
+++ wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo-min.js Thu Dec 30 11:53:40 2010
@@ -1,7 +1,7 @@
/*
-Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 2.7.0
+http://developer.yahoo.com/yui/license.html
+version: 2.8.2r1
*/
-if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=(""+A[C]).split(".");E=YAHOO;for(B=(D[0]=="YAHOO")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]];}}return E;};YAHOO.log=function(D,A,C){var B=YAHOO.widget.Logger;if(B&&B.log){return B.log(D,A,C);}else{return false;}};YAHOO.register=function(A,E,D){var I=YAHOO.env.modules,B,H,G,F,C;if(!I[A]){I[A]={versions:[],builds:[]};}B=I[A];H=D.version;G=D.build;F=YAHOO.env.listeners;B.name=A;B.version=H;B.build=G;B.versions.push(H);B.builds.push(G);B.mainClass=E;for(C=0;C<F.length;C=C+1){F[C](B);}if(E){E.VERSION=H;E.BUILD=G;}else{YAHOO.log("mainClass is undefined for module "+A,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(A){return YAHOO.env.modules[A]||null;};YAHOO.env.ua=function(){var C={ie:0,opera:0,gecko:0,webkit:0,mobile:null,air:0,caja:0},B=navigator.userAgent,A;if((/KHTML/).test(B)){C.webkit=1;}A=B
.match(/AppleWebKit\/([^\s]*)/);if(A&&A[1]){C.webkit=parseFloat(A[1]);if(/ Mobile\//.test(B)){C.mobile="Apple";}else{A=B.match(/NokiaN[^\/]*/);if(A){C.mobile=A[0];}}A=B.match(/AdobeAIR\/([^\s]*)/);if(A){C.air=A[0];}}if(!C.webkit){A=B.match(/Opera[\s\/]([^\s]*)/);if(A&&A[1]){C.opera=parseFloat(A[1]);A=B.match(/Opera Mini[^;]*/);if(A){C.mobile=A[0];}}else{A=B.match(/MSIE\s([^;]*)/);if(A&&A[1]){C.ie=parseFloat(A[1]);}else{A=B.match(/Gecko\/([^\s]*)/);if(A){C.gecko=1;A=B.match(/rv:([^\s\)]*)/);if(A&&A[1]){C.gecko=parseFloat(A[1]);}}}}}A=B.match(/Caja\/([^\s]*)/);if(A&&A[1]){C.caja=parseFloat(A[1]);}return C;}();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var B=YAHOO_config.listener,A=YAHOO.env.listeners,D=true,C;if(B){for(C=0;C<A.length;C=C+1){if(A[C]==B){D=false;break;}}if(D){A.push(B);}}}})();YAHOO.lang=YAHOO.lang||{};(function(){var B=YAHOO.lang,F="[object Array]",C="[object Function]",A=Object.prototype,E=["toString","valueOf"
],D={isArray:function(G){return A.toString.apply(G)===F;},isBoolean:function(G){return typeof G==="boolean";},isFunction:function(G){return A.toString.apply(G)===C;},isNull:function(G){return G===null;},isNumber:function(G){return typeof G==="number"&&isFinite(G);},isObject:function(G){return(G&&(typeof G==="object"||B.isFunction(G)))||false;},isString:function(G){return typeof G==="string";},isUndefined:function(G){return typeof G==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(I,H){var G,K,J;for(G=0;G<E.length;G=G+1){K=E[G];J=H[K];if(B.isFunction(J)&&J!=A[K]){I[K]=J;}}}:function(){},extend:function(J,K,I){if(!K||!J){throw new Error("extend failed, please check that "+"all dependencies are included.");}var H=function(){},G;H.prototype=K.prototype;J.prototype=new H();J.prototype.constructor=J;J.superclass=K.prototype;if(K.prototype.constructor==A.constructor){K.prototype.constructor=K;}if(I){for(G in I){if(B.hasOwnProperty(I,G)){J.prototype[G]=I[G];}}B._IEEnumFix(J.pro
totype,I);}},augmentObject:function(K,J){if(!J||!K){throw new Error("Absorb failed, verify dependencies.");}var G=arguments,I,L,H=G[2];if(H&&H!==true){for(I=2;I<G.length;I=I+1){K[G[I]]=J[G[I]];}}else{for(L in J){if(H||!(L in K)){K[L]=J[L];}}B._IEEnumFix(K,J);}},augmentProto:function(J,I){if(!I||!J){throw new Error("Augment failed, verify dependencies.");}var G=[J.prototype,I.prototype],H;for(H=2;H<arguments.length;H=H+1){G.push(arguments[H]);}B.augmentObject.apply(this,G);},dump:function(G,L){var I,K,N=[],O="{...}",H="f(){...}",M=", ",J=" => ";if(!B.isObject(G)){return G+"";}else{if(G instanceof Date||("nodeType" in G&&"tagName" in G)){return G;}else{if(B.isFunction(G)){return H;}}}L=(B.isNumber(L))?L:3;if(B.isArray(G)){N.push("[");for(I=0,K=G.length;I<K;I=I+1){if(B.isObject(G[I])){N.push((L>0)?B.dump(G[I],L-1):O);}else{N.push(G[I]);}N.push(M);}if(N.length>1){N.pop();}N.push("]");}else{N.push("{");for(I in G){if(B.hasOwnProperty(G,I)){N.push(I+J);if(B.isObject(G[I])){N.push(
(L>0)?B.dump(G[I],L-1):O);}else{N.push(G[I]);}N.push(M);}}if(N.length>1){N.pop();}N.push("}");}return N.join("");},substitute:function(V,H,O){var L,K,J,R,S,U,Q=[],I,M="dump",P=" ",G="{",T="}",N;for(;;){L=V.lastIndexOf(G);if(L<0){break;}K=V.indexOf(T,L);if(L+1>=K){break;}I=V.substring(L+1,K);R=I;U=null;J=R.indexOf(P);if(J>-1){U=R.substring(J+1);R=R.substring(0,J);}S=H[R];if(O){S=O(R,S,U);}if(B.isObject(S)){if(B.isArray(S)){S=B.dump(S,parseInt(U,10));}else{U=U||"";N=U.indexOf(M);if(N>-1){U=U.substring(4);}if(S.toString===A.toString||N>-1){S=B.dump(S,parseInt(U,10));}else{S=S.toString();}}}else{if(!B.isString(S)&&!B.isNumber(S)){S="~-"+Q.length+"-~";Q[Q.length]=I;}}V=V.substring(0,L)+S+V.substring(K+1);}for(L=Q.length-1;L>=0;L=L-1){V=V.replace(new RegExp("~-"+L+"-~"),"{"+Q[L]+"}","g");}return V;},trim:function(G){try{return G.replace(/^\s+|\s+$/g,"");}catch(H){return G;}},merge:function(){var J={},H=arguments,G=H.length,I;for(I=0;I<G;I=I+1){B.augmentObject(J,H[I],true);}return
J;},later:function(N,H,O,J,K){N=N||0;H=H||{};var I=O,M=J,L,G;if(B.isString(O)){I=H[O];}if(!I){throw new TypeError("method undefined");}if(!B.isArray(M)){M=[J];}L=function(){I.apply(H,M);};G=(K)?setInterval(L,N):setTimeout(L,N);return{interval:K,cancel:function(){if(this.interval){clearInterval(G);}else{clearTimeout(G);}}};},isValue:function(G){return(B.isObject(G)||B.isString(G)||B.isNumber(G)||B.isBoolean(G));}};B.hasOwnProperty=(A.hasOwnProperty)?function(G,H){return G&&G.hasOwnProperty(H);}:function(G,H){return !B.isUndefined(G[H])&&G.constructor.prototype[H]!==G[H];};D.augmentObject(B,D,true);YAHOO.util.Lang=B;B.augment=B.augmentProto;YAHOO.augment=B.augmentProto;YAHOO.extend=B.extend;})();YAHOO.register("yahoo",YAHOO,{version:"2.7.0",build:"1799"});
\ No newline at end of file
+if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=(""+A[C]).split(".");E=YAHOO;for(B=(D[0]=="YAHOO")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]];}}return E;};YAHOO.log=function(D,A,C){var B=YAHOO.widget.Logger;if(B&&B.log){return B.log(D,A,C);}else{return false;}};YAHOO.register=function(A,E,D){var I=YAHOO.env.modules,B,H,G,F,C;if(!I[A]){I[A]={versions:[],builds:[]};}B=I[A];H=D.version;G=D.build;F=YAHOO.env.listeners;B.name=A;B.version=H;B.build=G;B.versions.push(H);B.builds.push(G);B.mainClass=E;for(C=0;C<F.length;C=C+1){F[C](B);}if(E){E.VERSION=H;E.BUILD=G;}else{YAHOO.log("mainClass is undefined for module "+A,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(A){return YAHOO.env.modules[A]||null;};YAHOO.env.ua=function(){var D=function(H){var I=0;return parseFloat(H.replace(/\./g,function(){return(I++==1)?"":".";}));},G=navigator,F={ie:0,opera
:0,gecko:0,webkit:0,mobile:null,air:0,caja:G.cajaVersion,secure:false,os:null},C=navigator&&navigator.userAgent,E=window&&window.location,B=E&&E.href,A;F.secure=B&&(B.toLowerCase().indexOf("https")===0);if(C){if((/windows|win32/i).test(C)){F.os="windows";}else{if((/macintosh/i).test(C)){F.os="macintosh";}}if((/KHTML/).test(C)){F.webkit=1;}A=C.match(/AppleWebKit\/([^\s]*)/);if(A&&A[1]){F.webkit=D(A[1]);if(/ Mobile\//.test(C)){F.mobile="Apple";}else{A=C.match(/NokiaN[^\/]*/);if(A){F.mobile=A[0];}}A=C.match(/AdobeAIR\/([^\s]*)/);if(A){F.air=A[0];}}if(!F.webkit){A=C.match(/Opera[\s\/]([^\s]*)/);if(A&&A[1]){F.opera=D(A[1]);A=C.match(/Opera Mini[^;]*/);if(A){F.mobile=A[0];}}else{A=C.match(/MSIE\s([^;]*)/);if(A&&A[1]){F.ie=D(A[1]);}else{A=C.match(/Gecko\/([^\s]*)/);if(A){F.gecko=1;A=C.match(/rv:([^\s\)]*)/);if(A&&A[1]){F.gecko=D(A[1]);}}}}}}return F;}();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var B=YAHOO_config.listener,A=YAHOO.e
nv.listeners,D=true,C;if(B){for(C=0;C<A.length;C++){if(A[C]==B){D=false;break;}}if(D){A.push(B);}}}})();YAHOO.lang=YAHOO.lang||{};(function(){var B=YAHOO.lang,A=Object.prototype,H="[object Array]",C="[object Function]",G="[object Object]",E=[],F=["toString","valueOf"],D={isArray:function(I){return A.toString.apply(I)===H;},isBoolean:function(I){return typeof I==="boolean";},isFunction:function(I){return(typeof I==="function")||A.toString.apply(I)===C;},isNull:function(I){return I===null;},isNumber:function(I){return typeof I==="number"&&isFinite(I);},isObject:function(I){return(I&&(typeof I==="object"||B.isFunction(I)))||false;},isString:function(I){return typeof I==="string";},isUndefined:function(I){return typeof I==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(K,J){var I,M,L;for(I=0;I<F.length;I=I+1){M=F[I];L=J[M];if(B.isFunction(L)&&L!=A[M]){K[M]=L;}}}:function(){},extend:function(L,M,K){if(!M||!L){throw new Error("extend failed, please check that "+"all dependenc
ies are included.");}var J=function(){},I;J.prototype=M.prototype;L.prototype=new J();L.prototype.constructor=L;L.superclass=M.prototype;if(M.prototype.constructor==A.constructor){M.prototype.constructor=M;}if(K){for(I in K){if(B.hasOwnProperty(K,I)){L.prototype[I]=K[I];}}B._IEEnumFix(L.prototype,K);}},augmentObject:function(M,L){if(!L||!M){throw new Error("Absorb failed, verify dependencies.");}var I=arguments,K,N,J=I[2];if(J&&J!==true){for(K=2;K<I.length;K=K+1){M[I[K]]=L[I[K]];}}else{for(N in L){if(J||!(N in M)){M[N]=L[N];}}B._IEEnumFix(M,L);}},augmentProto:function(L,K){if(!K||!L){throw new Error("Augment failed, verify dependencies.");}var I=[L.prototype,K.prototype],J;for(J=2;J<arguments.length;J=J+1){I.push(arguments[J]);}B.augmentObject.apply(this,I);},dump:function(I,N){var K,M,P=[],Q="{...}",J="f(){...}",O=", ",L=" => ";if(!B.isObject(I)){return I+"";}else{if(I instanceof Date||("nodeType" in I&&"tagName" in I)){return I;}else{if(B.isFunction(I)){return J;}}}N=(B.is
Number(N))?N:3;if(B.isArray(I)){P.push("[");for(K=0,M=I.length;K<M;K=K+1){if(B.isObject(I[K])){P.push((N>0)?B.dump(I[K],N-1):Q);}else{P.push(I[K]);}P.push(O);}if(P.length>1){P.pop();}P.push("]");}else{P.push("{");for(K in I){if(B.hasOwnProperty(I,K)){P.push(K+L);if(B.isObject(I[K])){P.push((N>0)?B.dump(I[K],N-1):Q);}else{P.push(I[K]);}P.push(O);}}if(P.length>1){P.pop();}P.push("}");}return P.join("");},substitute:function(Y,J,R){var N,M,L,U,V,X,T=[],K,O="dump",S=" ",I="{",W="}",Q,P;for(;;){N=Y.lastIndexOf(I);if(N<0){break;}M=Y.indexOf(W,N);if(N+1>=M){break;}K=Y.substring(N+1,M);U=K;X=null;L=U.indexOf(S);if(L>-1){X=U.substring(L+1);U=U.substring(0,L);}V=J[U];if(R){V=R(U,V,X);}if(B.isObject(V)){if(B.isArray(V)){V=B.dump(V,parseInt(X,10));}else{X=X||"";Q=X.indexOf(O);if(Q>-1){X=X.substring(4);}P=V.toString();if(P===G||Q>-1){V=B.dump(V,parseInt(X,10));}else{V=P;}}}else{if(!B.isString(V)&&!B.isNumber(V)){V="~-"+T.length+"-~";T[T.length]=K;}}Y=Y.substring(0,N)+V+Y.substring(M+1);}
for(N=T.length-1;N>=0;N=N-1){Y=Y.replace(new RegExp("~-"+N+"-~"),"{"+T[N]+"}","g");}return Y;},trim:function(I){try{return I.replace(/^\s+|\s+$/g,"");}catch(J){return I;}},merge:function(){var L={},J=arguments,I=J.length,K;for(K=0;K<I;K=K+1){B.augmentObject(L,J[K],true);}return L;},later:function(P,J,Q,L,M){P=P||0;J=J||{};var K=Q,O=L,N,I;if(B.isString(Q)){K=J[Q];}if(!K){throw new TypeError("method undefined");}if(O&&!B.isArray(O)){O=[L];}N=function(){K.apply(J,O||E);};I=(M)?setInterval(N,P):setTimeout(N,P);return{interval:M,cancel:function(){if(this.interval){clearInterval(I);}else{clearTimeout(I);}}};},isValue:function(I){return(B.isObject(I)||B.isString(I)||B.isNumber(I)||B.isBoolean(I));}};B.hasOwnProperty=(A.hasOwnProperty)?function(I,J){return I&&I.hasOwnProperty(J);}:function(I,J){return !B.isUndefined(I[J])&&I.constructor.prototype[J]!==I[J];};D.augmentObject(B,D,true);YAHOO.util.Lang=B;B.augment=B.augmentProto;YAHOO.augment=B.augmentProto;YAHOO.extend=B.extend;})();Y
AHOO.register("yahoo",YAHOO,{version:"2.8.2r1",build:"7"});
Modified: wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo.js
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo.js?rev=1053863&r1=1053862&r2=1053863&view=diff
==============================================================================
--- wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo.js (original)
+++ wicket/trunk/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo.js Thu Dec 30 11:53:40 2010
@@ -1,8 +1,8 @@
/*
-Copyright (c) 2009, Yahoo! Inc. All rights reserved.
+Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-version: 2.7.0
+http://developer.yahoo.com/yui/license.html
+version: 2.8.2r1
*/
/**
* The YAHOO object is the single global object used by YUI Library. It
@@ -89,8 +89,13 @@ if (typeof YAHOO == "undefined" || !YAHO
* This fails because "long" is a future reserved word in ECMAScript
*
* For implementation code that uses YUI, do not create your components
- * in the namespaces created by the library. defined by YUI -- create
- * your own (YAHOO.util, YAHOO.widget, YAHOO.lang, YAHOO.env)
+ * in the namespaces defined by YUI (
+ * <code>YAHOO.util</code>,
+ * <code>YAHOO.widget</code>,
+ * <code>YAHOO.lang</code>,
+ * <code>YAHOO.tool</code>,
+ * <code>YAHOO.example</code>,
+ * <code>YAHOO.env</code>) -- create your own namespace (e.g., 'companyname').
*
* @method namespace
* @static
@@ -245,21 +250,31 @@ YAHOO.env.getVersion = function(name) {
* @static
*/
YAHOO.env.ua = function() {
- var o={
+
+ var numberfy = function(s) {
+ var c = 0;
+ return parseFloat(s.replace(/\./g, function() {
+ return (c++ == 1) ? '' : '.';
+ }));
+ },
+
+ nav = navigator,
+
+ o = {
/**
* Internet Explorer version number or 0. Example: 6
* @property ie
* @type float
*/
- ie:0,
+ ie: 0,
/**
* Opera version number or 0. Example: 9.2
* @property opera
* @type float
*/
- opera:0,
+ opera: 0,
/**
* Gecko engine revision number. Will evaluate to 1 if Gecko
@@ -274,7 +289,7 @@ YAHOO.env.ua = function() {
* @property gecko
* @type float
*/
- gecko:0,
+ gecko: 0,
/**
* AppleWebKit version. KHTML browsers that are not WebKit browsers
@@ -329,71 +344,98 @@ YAHOO.env.ua = function() {
* @property caja
* @type float
*/
- caja: 0
+ caja: nav.cajaVersion,
+
+ /**
+ * Set to true if the page appears to be in SSL
+ * @property secure
+ * @type boolean
+ * @static
+ */
+ secure: false,
+
+ /**
+ * The operating system. Currently only detecting windows or macintosh
+ * @property os
+ * @type string
+ * @static
+ */
+ os: null
},
- ua = navigator.userAgent,
+ ua = navigator && navigator.userAgent,
+
+ loc = window && window.location,
+
+ href = loc && loc.href,
m;
- // Modern KHTML browsers should qualify as Safari X-Grade
- if ((/KHTML/).test(ua)) {
- o.webkit=1;
- }
- // Modern WebKit browsers are at least X-Grade
- m=ua.match(/AppleWebKit\/([^\s]*)/);
- if (m&&m[1]) {
- o.webkit=parseFloat(m[1]);
-
- // Mobile browser check
- if (/ Mobile\//.test(ua)) {
- o.mobile = "Apple"; // iPhone or iPod Touch
- } else {
- m=ua.match(/NokiaN[^\/]*/);
- if (m) {
- o.mobile = m[0]; // Nokia N-series, ex: NokiaN95
- }
- }
+ o.secure = href && (href.toLowerCase().indexOf("https") === 0);
- m=ua.match(/AdobeAIR\/([^\s]*)/);
- if (m) {
- o.air = m[0]; // Adobe AIR 1.0 or better
- }
+ if (ua) {
- }
+ if ((/windows|win32/i).test(ua)) {
+ o.os = 'windows';
+ } else if ((/macintosh/i).test(ua)) {
+ o.os = 'macintosh';
+ }
+
+ // Modern KHTML browsers should qualify as Safari X-Grade
+ if ((/KHTML/).test(ua)) {
+ o.webkit=1;
+ }
- if (!o.webkit) { // not webkit
- // @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
- m=ua.match(/Opera[\s\/]([^\s]*)/);
+ // Modern WebKit browsers are at least X-Grade
+ m=ua.match(/AppleWebKit\/([^\s]*)/);
if (m&&m[1]) {
- o.opera=parseFloat(m[1]);
- m=ua.match(/Opera Mini[^;]*/);
+ o.webkit=numberfy(m[1]);
+
+ // Mobile browser check
+ if (/ Mobile\//.test(ua)) {
+ o.mobile = "Apple"; // iPhone or iPod Touch
+ } else {
+ m=ua.match(/NokiaN[^\/]*/);
+ if (m) {
+ o.mobile = m[0]; // Nokia N-series, ex: NokiaN95
+ }
+ }
+
+ m=ua.match(/AdobeAIR\/([^\s]*)/);
if (m) {
- o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316
+ o.air = m[0]; // Adobe AIR 1.0 or better
}
- } else { // not opera or webkit
- m=ua.match(/MSIE\s([^;]*)/);
+
+ }
+
+ if (!o.webkit) { // not webkit
+ // @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
+ m=ua.match(/Opera[\s\/]([^\s]*)/);
if (m&&m[1]) {
- o.ie=parseFloat(m[1]);
- } else { // not opera, webkit, or ie
- m=ua.match(/Gecko\/([^\s]*)/);
+ o.opera=numberfy(m[1]);
+ m=ua.match(/Opera Mini[^;]*/);
if (m) {
- o.gecko=1; // Gecko detected, look for revision
- m=ua.match(/rv:([^\s\)]*)/);
- if (m&&m[1]) {
- o.gecko=parseFloat(m[1]);
+ o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316
+ }
+ } else { // not opera or webkit
+ m=ua.match(/MSIE\s([^;]*)/);
+ if (m&&m[1]) {
+ o.ie=numberfy(m[1]);
+ } else { // not opera, webkit, or ie
+ m=ua.match(/Gecko\/([^\s]*)/);
+ if (m) {
+ o.gecko=1; // Gecko detected, look for revision
+ m=ua.match(/rv:([^\s\)]*)/);
+ if (m&&m[1]) {
+ o.gecko=numberfy(m[1]);
+ }
}
}
}
}
}
- m=ua.match(/Caja\/([^\s]*)/);
- if (m&&m[1]) {
- o.caja=parseFloat(m[1]);
- }
-
return o;
}();
@@ -409,17 +451,18 @@ YAHOO.env.ua = function() {
YAHOO.namespace("util", "widget", "example");
/*global YAHOO_config*/
if ("undefined" !== typeof YAHOO_config) {
- var l=YAHOO_config.listener,ls=YAHOO.env.listeners,unique=true,i;
+ var l=YAHOO_config.listener, ls=YAHOO.env.listeners,unique=true, i;
if (l) {
// if YAHOO is loaded multiple times we need to check to see if
// this is a new config object. If it is, add the new component
// load listener to the stack
- for (i=0;i<ls.length;i=i+1) {
- if (ls[i]==l) {
- unique=false;
+ for (i=0; i<ls.length; i++) {
+ if (ls[i] == l) {
+ unique = false;
break;
}
}
+
if (unique) {
ls.push(l);
}
@@ -437,9 +480,11 @@ YAHOO.lang = YAHOO.lang || {};
var L = YAHOO.lang,
+ OP = Object.prototype,
ARRAY_TOSTRING = '[object Array]',
FUNCTION_TOSTRING = '[object Function]',
- OP = Object.prototype,
+ OBJECT_TOSTRING = '[object Object]',
+ NOTHING = [],
// ADD = ["toString", "valueOf", "hasOwnProperty"],
ADD = ["toString", "valueOf"],
@@ -484,7 +529,7 @@ var L = YAHOO.lang,
* @return {boolean} the result
*/
isFunction: function(o) {
- return OP.toString.apply(o) === FUNCTION_TOSTRING;
+ return (typeof o === 'function') || OP.toString.apply(o) === FUNCTION_TOSTRING;
},
/**
@@ -764,7 +809,7 @@ return (o && (typeof o === 'object' || L
substitute: function (s, o, f) {
var i, j, k, key, v, meta, saved=[], token,
DUMP='dump', SPACE=' ', LBRACE='{', RBRACE='}',
- dump;
+ dump, objstr;
for (;;) {
@@ -807,12 +852,14 @@ return (o && (typeof o === 'object' || L
meta = meta.substring(4);
}
+ objstr = v.toString();
+
// use the toString if it is not the Object toString
// and the 'dump' meta info was not found
- if (v.toString===OP.toString || dump>-1) {
+ if (objstr === OBJECT_TOSTRING || dump > -1) {
v = L.dump(v, parseInt(meta, 10));
} else {
- v = v.toString();
+ v = objstr;
}
}
} else if (!L.isString(v) && !L.isNumber(v)) {
@@ -904,12 +951,12 @@ return (o && (typeof o === 'object' || L
throw new TypeError("method undefined");
}
- if (!L.isArray(d)) {
+ if (d && !L.isArray(d)) {
d = [data];
}
f = function() {
- m.apply(o, d);
+ m.apply(o, d || NOTHING);
};
r = (periodic) ? setInterval(f, when) : setTimeout(f, when);
@@ -1025,4 +1072,4 @@ YAHOO.augment = L.augmentProto;
YAHOO.extend = L.extend;
})();
-YAHOO.register("yahoo", YAHOO, {version: "2.7.0", build: "1799"});
+YAHOO.register("yahoo", YAHOO, {version: "2.8.2r1", build: "7"});