/* Copyright (c) 2007, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 2.2.0 */ /** * The YAHOO object is the single global object used by YUI Library. It * contains utility function for setting up namespaces, inheritance, and * logging. YAHOO.util, YAHOO.widget, and YAHOO.example are namespaces * created automatically for and used by the library. * @module yahoo * @title YAHOO Global */ /** * YAHOO_config is not included part of the library. Instead it is an object * that can be defined by the implementer immediately before including the * YUI library. The properties included in this object will be used to * configure global properties needed as soon as the library begins to load. * @class YAHOO_config * @static */ /** * A reference to a function that will be executed every time a YAHOO module * is loaded. As parameter, this function will receive the version * information for the module. See * YAHOO.env.getVersion for the description of the version data structure. * @property listener * @static */ if (typeof YAHOO == "undefined") { /** * The YAHOO global namespace object. If YAHOO is already defined, the * existing YAHOO object will not be overwritten so that defined * namespaces are preserved. * @class YAHOO * @static */ var YAHOO = {}; } /** * Returns the namespace specified and creates it if it doesn't exist *
 * YAHOO.namespace("property.package");
 * YAHOO.namespace("YAHOO.property.package");
 * 
* Either of the above would create YAHOO.property, then * YAHOO.property.package * * Be careful when naming packages. Reserved words may work in some browsers * and not others. For instance, the following will fail in Safari: *
 * YAHOO.namespace("really.long.nested.namespace");
 * 
* This fails because "long" is a future reserved word in ECMAScript * * @method namespace * @static * @param {String*} arguments 1-n namespaces to create * @return {Object} A reference to the last namespace object created */ YAHOO.namespace = function() { var a=arguments, o=null, i, j, d; for (i=0; i *
name:
The name of the module
*
version:
The version in use
*
build:
The build number in use
*
versions:
All versions that were registered
*
builds:
All builds that were registered.
*
mainClass:
An object that was was stamped with the * current version and build. If * mainClass.VERSION != version or mainClass.BUILD != build, * multiple versions of pieces of the library have been * loaded, potentially causing issues.
* * * @method getVersion * @static * @param {String} name the name of the module (event, slider, etc) * @return {Object} The version info */ getVersion: function(name) { return YAHOO.env.modules[name] || null; } }; /** * Provides the language utilites and extensions used by the library * @class YAHOO.lang */ YAHOO.lang = { /** * Determines whether or not the provided object is an array * @method isArray * @param {any} obj The object being testing * @return Boolean */ isArray: function(obj) { // frames lose type, so test constructor string if (obj.constructor && obj.constructor.toString().indexOf('Array') > -1) { return true; } else { return YAHOO.lang.isObject(obj) && obj.constructor == Array; } }, /** * Determines whether or not the provided object is a boolean * @method isBoolean * @param {any} obj The object being testing * @return Boolean */ isBoolean: function(obj) { return typeof obj == 'boolean'; }, /** * Determines whether or not the provided object is a function * @method isFunction * @param {any} obj The object being testing * @return Boolean */ isFunction: function(obj) { return typeof obj == 'function'; }, /** * Determines whether or not the provided object is null * @method isNull * @param {any} obj The object being testing * @return Boolean */ isNull: function(obj) { return obj === null; }, /** * Determines whether or not the provided object is a legal number * @method isNumber * @param {any} obj The object being testing * @return Boolean */ isNumber: function(obj) { return typeof obj == 'number' && isFinite(obj); }, /** * Determines whether or not the provided object is of type object * or function * @method isObject * @param {any} obj The object being testing * @return Boolean */ isObject: function(obj) { return typeof obj == 'object' || YAHOO.lang.isFunction(obj); }, /** * Determines whether or not the provided object is a string * @method isString * @param {any} obj The object being testing * @return Boolean */ isString: function(obj) { return typeof obj == 'string'; }, /** * Determines whether or not the provided object is undefined * @method isUndefined * @param {any} obj The object being testing * @return Boolean */ isUndefined: function(obj) { return typeof obj == '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} obj The object being testing * @return Boolean */ hasOwnProperty: function(obj, prop) { if (Object.prototype.hasOwnProperty) { return obj.hasOwnProperty(prop); } return !YAHOO.lang.isUndefined(obj[prop]) && obj.constructor.prototype[prop] !== obj[prop]; }, /** * Utility to set up the prototype, constructor and superclass properties to * support an inheritance strategy that can chain constructors and methods. * * @method extend * @static * @param {Function} subc the object to modify * @param {Function} superc the object to inherit * @param {Object} overrides additional properties/methods to add to the * subclass prototype. These will override the * matching items obtained from the superclass * if present. */ extend: function(subc, superc, overrides) { var F = function() {}; F.prototype=superc.prototype; subc.prototype=new F(); subc.prototype.constructor=subc; subc.superclass=superc.prototype; if (superc.prototype.constructor == Object.prototype.constructor) { superc.prototype.constructor=superc; } if (overrides) { for (var i in overrides) { subc.prototype[i]=overrides[i]; } } }, /** * Applies all prototype properties in the supplier to the receiver if the * receiver does not have these properties yet. Optionally, one or more * methods/properties can be specified (as additional parameters). This * option will overwrite the property if receiver has it already. * * @method augment * @static * @param {Function} r the object to receive the augmentation * @param {Function} s the object that supplies the properties to augment * @param {String*} arguments zero or more properties methods to augment the * receiver with. If none specified, everything * in the supplier will be used unless it would * overwrite an existing property in the receiver */ augment: function(r, s) { var rp=r.prototype, sp=s.prototype, a=arguments, i, p; if (a[2]) { for (i=2; iYAHOO.lang * @class YAHOO.util.Lang */ YAHOO.util.Lang = YAHOO.lang; /** * An alias for YAHOO.lang.augment * @for YAHOO * @method augment * @static * @param {Function} r the object to receive the augmentation * @param {Function} s the object that supplies the properties to augment * @param {String*} arguments zero or more properties methods to augment the * receiver with. If none specified, everything * in the supplier will be used unless it would * overwrite an existing property in the receiver */ YAHOO.augment = YAHOO.lang.augment; /** * An alias for YAHOO.lang.extend * @method extend * @static * @param {Function} subc the object to modify * @param {Function} superc the object to inherit * @param {Object} overrides additional properties/methods to add to the * subclass prototype. These will override the * matching items obtained from the superclass * if present. */ YAHOO.extend = YAHOO.lang.extend; YAHOO.register("yahoo", YAHOO, {version: "2.2.0", build: "127"});