Index: openacs-4/packages/ajaxhelper/www/resources/yui/yahoo/yahoo-debug.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajaxhelper/www/resources/yui/yahoo/yahoo-debug.js,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ajaxhelper/www/resources/yui/yahoo/yahoo-debug.js 8 Sep 2007 14:22:10 -0000 1.3 +++ openacs-4/packages/ajaxhelper/www/resources/yui/yahoo/yahoo-debug.js 9 Apr 2009 23:15:50 -0000 1.4 @@ -1,8 +1,8 @@ /* -Copyright (c) 2007, Yahoo! Inc. All rights reserved. +Copyright (c) 2009, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt -version: 2.3.0 +version: 2.7.0 */ /** * The YAHOO object is the single global object used by YUI Library. It @@ -53,7 +53,15 @@ * @see yuiloader */ -if (typeof YAHOO == "undefined") { +/** + * Forces the use of the supplied locale where applicable in the library + * @property locale + * @type string + * @static + * @default undefined + */ + +if (typeof YAHOO == "undefined" || !YAHOO) { /** * The YAHOO global namespace object. If YAHOO is already defined, the * existing YAHOO object will not be overwritten so that defined @@ -80,6 +88,10 @@ * * 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) + * * @method namespace * @static * @param {String*} arguments 1-n namespaces to create @@ -88,7 +100,7 @@ YAHOO.namespace = function() { var a=arguments, o=null, i, j, d; for (i=0; i * http://developer.apple.com/internet/safari/uamatrix.html * @property webkit * @type float */ - webkit:0 - }; + webkit: 0, - var ua=navigator.userAgent, m; + /** + * The mobile property will be set to a string containing any relevant + * user agent information when a modern mobile browser is detected. + * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series + * devices with the WebKit-based browser, and Opera Mini. + * @property mobile + * @type string + */ + mobile: null, + /** + * Adobe AIR version number or 0. Only populated if webkit is detected. + * Example: 1.0 + * @property air + * @type float + */ + air: 0, + + /** + * Google Caja version number or 0. + * @property caja + * @type float + */ + caja: 0 + + }, + + ua = navigator.userAgent, + + m; + // Modern KHTML browsers should qualify as Safari X-Grade if ((/KHTML/).test(ua)) { o.webkit=1; @@ -286,13 +345,33 @@ 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 + } + } + + m=ua.match(/AdobeAIR\/([^\s]*)/); + if (m) { + o.air = m[0]; // Adobe AIR 1.0 or better + } + } 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.opera=parseFloat(m[1]); + m=ua.match(/Opera Mini[^;]*/); + if (m) { + 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]) { @@ -309,6 +388,11 @@ } } } + + m=ua.match(/Caja\/([^\s]*)/); + if (m&&m[1]) { + o.caja=parseFloat(m[1]); + } return o; }(); @@ -323,7 +407,8 @@ */ (function() { YAHOO.namespace("util", "widget", "example"); - if (typeof YAHOO_config != "undefined") { + /*global YAHOO_config*/ + if ("undefined" !== typeof YAHOO_config) { 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 @@ -345,53 +430,68 @@ * Provides the language utilites and extensions used by the library * @class YAHOO.lang */ -YAHOO.lang = { +YAHOO.lang = YAHOO.lang || {}; + +(function() { + + +var L = YAHOO.lang, + + ARRAY_TOSTRING = '[object Array]', + FUNCTION_TOSTRING = '[object Function]', + OP = Object.prototype, + + // ADD = ["toString", "valueOf", "hasOwnProperty"], + ADD = ["toString", "valueOf"], + + OB = { + /** - * Determines whether or not the provided object is an array. - * Testing typeof/instanceof/constructor of arrays across frame - * boundaries isn't possible in Safari unless you have a reference - * to the other frame to test against its Array prototype. To - * handle this case, we test well-known array properties instead. - * properties. + * Determines wheather or not the provided object is an array. * @method isArray * @param {any} o The object being testing - * @return Boolean + * @return {boolean} the result */ isArray: function(o) { - - if (o) { - var l = YAHOO.lang; - return l.isNumber(o.length) && l.isFunction(o.splice) && - !l.hasOwnProperty(o.length); - } - return false; + return OP.toString.apply(o) === ARRAY_TOSTRING; }, /** * Determines whether or not the provided object is a boolean * @method isBoolean * @param {any} o The object being testing - * @return Boolean + * @return {boolean} the result */ isBoolean: function(o) { return typeof o === 'boolean'; }, /** - * Determines whether or not the provided object is a function + * Determines whether or not the provided object is a function. + * Note: Internet Explorer thinks certain functions are objects: + * + * var obj = document.createElement("object"); + * YAHOO.lang.isFunction(obj.getAttribute) // reports false in IE + * + * var input = document.createElement("input"); // append to body + * YAHOO.lang.isFunction(input.focus) // reports false in IE + * + * You will have to implement additional tests if these functions + * matter to you. + * * @method isFunction * @param {any} o The object being testing - * @return Boolean + * @return {boolean} the result */ isFunction: function(o) { - return typeof o === 'function'; + return OP.toString.apply(o) === FUNCTION_TOSTRING; }, /** * Determines whether or not the provided object is null * @method isNull * @param {any} o The object being testing - * @return Boolean + * @return {boolean} the result */ isNull: function(o) { return o === null; @@ -401,7 +501,7 @@ * Determines whether or not the provided object is a legal number * @method isNumber * @param {any} o The object being testing - * @return Boolean + * @return {boolean} the result */ isNumber: function(o) { return typeof o === 'number' && isFinite(o); @@ -412,17 +512,17 @@ * or function * @method isObject * @param {any} o The object being testing - * @return Boolean + * @return {boolean} the result */ isObject: function(o) { -return (o && (typeof o === 'object' || YAHOO.lang.isFunction(o))) || false; +return (o && (typeof o === 'object' || L.isFunction(o))) || false; }, /** * Determines whether or not the provided object is a string * @method isString * @param {any} o The object being testing - * @return Boolean + * @return {boolean} the result */ isString: function(o) { return typeof o === 'string'; @@ -432,40 +532,12 @@ * Determines whether or not the provided object is undefined * @method isUndefined * @param {any} o The object being testing - * @return Boolean + * @return {boolean} the result */ isUndefined: function(o) { return typeof o === 'undefined'; }, - /** - * Determines whether or not the property was added - * to the object instance. Returns false if the property is not present - * in the object, or was inherited from the prototype. - * This abstraction is provided to enable hasOwnProperty for Safari 1.3.x. - * There is a discrepancy between YAHOO.lang.hasOwnProperty and - * Object.prototype.hasOwnProperty when the property is a primitive added to - * both the instance AND prototype with the same value: - *
-     * var A = function() {};
-     * A.prototype.foo = 'foo';
-     * var a = new A();
-     * a.foo = 'foo';
-     * alert(a.hasOwnProperty('foo')); // true
-     * alert(YAHOO.lang.hasOwnProperty(a, 'foo')); // false when using fallback
-     * 
- * @method hasOwnProperty - * @param {any} o The object being testing - * @return Boolean - */ - hasOwnProperty: function(o, prop) { - if (Object.prototype.hasOwnProperty) { - return o.hasOwnProperty(prop); - } - - return !YAHOO.lang.isUndefined(o[prop]) && - o.constructor.prototype[prop] !== o[prop]; - }, /** * IE will not enumerate native functions in a derived object even if the @@ -477,17 +549,18 @@ * @static * @private */ - _IEEnumFix: function(r, s) { - if (YAHOO.env.ua.ie) { - var add=["toString", "valueOf"]; - for (i=0;i 0) ? l.dump(o[i], d-1) : OBJ); + if (L.isObject(o[i])) { + s.push((d > 0) ? L.dump(o[i], d-1) : OBJ); } else { s.push(o[i]); } @@ -643,10 +719,10 @@ } else { s.push("{"); for (i in o) { - if (l.hasOwnProperty(o, i)) { + if (L.hasOwnProperty(o, i)) { s.push(i + ARROW); - if (l.isObject(o[i])) { - s.push((d > 0) ? l.dump(o[i], d-1) : OBJ); + if (L.isObject(o[i])) { + s.push((d > 0) ? L.dump(o[i], d-1) : OBJ); } else { s.push(o[i]); } @@ -686,8 +762,9 @@ * @return {String} the substituted string */ substitute: function (s, o, f) { - var i, j, k, key, v, meta, l=YAHOO.lang, saved=[], token, - DUMP='dump', SPACE=' ', LBRACE='{', RBRACE='}'; + var i, j, k, key, v, meta, saved=[], token, + DUMP='dump', SPACE=' ', LBRACE='{', RBRACE='}', + dump; for (;;) { @@ -718,27 +795,27 @@ v = f(key, v, meta); } - if (l.isObject(v)) { - if (l.isArray(v)) { - v = l.dump(v, parseInt(meta, 10)); + if (L.isObject(v)) { + if (L.isArray(v)) { + v = L.dump(v, parseInt(meta, 10)); } else { meta = meta || ""; // look for the keyword 'dump', if found force obj dump - var dump = meta.indexOf(DUMP); + dump = meta.indexOf(DUMP); if (dump > -1) { meta = meta.substring(4); } // use the toString if it is not the Object toString // and the 'dump' meta info was not found - if (v.toString===Object.prototype.toString||dump>-1) { - v = l.dump(v, parseInt(meta, 10)); + if (v.toString===OP.toString || dump>-1) { + v = L.dump(v, parseInt(meta, 10)); } else { v = v.toString(); } } - } else if (!l.isString(v) && !l.isNumber(v)) { + } else if (!L.isString(v) && !L.isNumber(v)) { // This {block} has no replace string. Save it for later. v = "~-" + saved.length + "-~"; saved[saved.length] = token; @@ -786,19 +863,70 @@ * @return the new merged object */ merge: function() { - var o={}, a=arguments, i; - for (i=0; i + * var A = function() {}; + * A.prototype.foo = 'foo'; + * var a = new A(); + * a.foo = 'foo'; + * alert(a.hasOwnProperty('foo')); // true + * alert(YAHOO.lang.hasOwnProperty(a, 'foo')); // false when using fallback + * + * @method hasOwnProperty + * @param {any} o The object being testing + * @param prop {string} the name of the property to test + * @return {boolean} the result + */ +L.hasOwnProperty = (OP.hasOwnProperty) ? + function(o, prop) { + return o && o.hasOwnProperty(prop); + } : function(o, prop) { + return !L.isUndefined(o[prop]) && + o.constructor.prototype[prop] !== o[prop]; + }; + +// new lang wins +OB.augmentObject(L, OB, true); + /* * An alias for YAHOO.lang * @class YAHOO.util.Lang */ -YAHOO.util.Lang = YAHOO.lang; +YAHOO.util.Lang = L; /** * Same as YAHOO.lang.augmentObject, except it only applies prototype @@ -837,7 +996,7 @@ * be applied and will overwrite an existing property in * the receiver */ -YAHOO.lang.augment = YAHOO.lang.augmentProto; +L.augment = L.augmentProto; /** * An alias for YAHOO.lang.augment @@ -851,7 +1010,7 @@ * in the supplier will be used unless it would * overwrite an existing property in the receiver */ -YAHOO.augment = YAHOO.lang.augmentProto; +YAHOO.augment = L.augmentProto; /** * An alias for YAHOO.lang.extend @@ -863,6 +1022,7 @@ * subclass prototype. These will override the * matching items obtained from the superclass if present. */ -YAHOO.extend = YAHOO.lang.extend; +YAHOO.extend = L.extend; -YAHOO.register("yahoo", YAHOO, {version: "2.3.0", build: "442"}); +})(); +YAHOO.register("yahoo", YAHOO, {version: "2.7.0", build: "1799"});