/* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt Version: 0.11.4 */ /** * 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 */ /** * The YAHOO global namespace object * @class YAHOO * @static */ if (typeof YAHOO == "undefined") { 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} ns The name of the namespace * @return {Object} A reference to the namespace object */ YAHOO.namespace = function(ns) { if (!ns || !ns.length) { return null; } var levels = ns.split("."); var nsobj = YAHOO; // YAHOO is implied, so it is ignored if it is included for (var i=(levels[0] == "YAHOO") ? 1 : 0; i