yui-base.js revision 7f42f69d1fb2e4ea5f1635fc635d3a6c70860c50
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * The YUI module contains the components required for building the YUI seed
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * file. This includes the script loading mechanism, a simple queue, and
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * the core utilities for the library.
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * @module yui
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * @submodule yui-base
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * The YUI global namespace object. If YUI is already defined, the
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * existing YUI object will not be overwritten so that defined
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * namespaces are preserved. It is the constructor for the object
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * the end user interacts with. As indicated below, each instance
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * has full custom event support, but only if the event system
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * is available. This is a self-instantiable factory function. You
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * can invoke it directly like this:
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * YUI().use('*', function(Y) {
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * But it also works like this:
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * var Y = YUI();
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * @class YUI
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * @constructor
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * @uses EventTarget
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * @param o* {object} 0..n optional configuration objects. these values
64436761af23a95069579e643c4ef13a252e330dLuke Smith * are store in Y.config. See config for the list of supported
64436761af23a95069579e643c4ef13a252e330dLuke Smith * properties.
64436761af23a95069579e643c4ef13a252e330dLuke Smith /*global YUI*/
64436761af23a95069579e643c4ef13a252e330dLuke Smith /*global YUI_config*/
64436761af23a95069579e643c4ef13a252e330dLuke Smith var YUI = function() {
64436761af23a95069579e643c4ef13a252e330dLuke Smith return (o && o.hasOwnProperty && (o instanceof type));
64436761af23a95069579e643c4ef13a252e330dLuke Smith gconf = (typeof YUI_config !== 'undefined') && YUI_config;
64436761af23a95069579e643c4ef13a252e330dLuke Smith // set up the core environment
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith // YUI.GlobalConfig is a master configuration that might span
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith // multiple contexts in a non-browser environment. It is applied
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith // first to all instances in all contexts.
64436761af23a95069579e643c4ef13a252e330dLuke Smith // YUI_Config is a page-level config. It is applied to all
998276643802ff9fb197fe220cbd9552da00a624Luke Smith // instances created on the page. This is applied after
998276643802ff9fb197fe220cbd9552da00a624Luke Smith // YUI.GlobalConfig, and before the instance level configuration
998276643802ff9fb197fe220cbd9552da00a624Luke Smith // bind the specified additional modules for this instance
64436761af23a95069579e643c4ef13a252e330dLuke Smith // Each instance can accept one or more configuration objects.
64436761af23a95069579e643c4ef13a252e330dLuke Smith // These are applied after YUI.GlobalConfig and YUI_Config,
64436761af23a95069579e643c4ef13a252e330dLuke Smith // overriding values set in those config files if there is a '
64436761af23a95069579e643c4ef13a252e330dLuke Smith // matching property.
64436761af23a95069579e643c4ef13a252e330dLuke Smith for (; i < l; i++) {
64436761af23a95069579e643c4ef13a252e330dLuke Smith(function() {
64436761af23a95069579e643c4ef13a252e330dLuke Smith NOOP = function() {},
64436761af23a95069579e643c4ef13a252e330dLuke Smith APPLY_TO_AUTH = { 'io.xdrReady': 1, // the functions applyTo
64436761af23a95069579e643c4ef13a252e330dLuke Smith 'SWF.eventHandler': 1 }, // be done at build time
64436761af23a95069579e643c4ef13a252e330dLuke Smith // this can throw an uncaught exception in FF
64436761af23a95069579e643c4ef13a252e330dLuke Smith } catch (ex) {}
64436761af23a95069579e643c4ef13a252e330dLuke Smith handleLoad = function() {
64436761af23a95069579e643c4ef13a252e330dLuke Smith getLoader = function(Y, o) {
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith clobber = function(r, s) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith for (var i in s) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith r[i] = s[i];
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith// Stamp the documentElement (HTML) with a class of "yui-loaded" to
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith// enable styles that need to key off of JS being enabled.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * Applies a new configuration object to the YUI instance config.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * This will merge new group/module definitions, and will also
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * update the loader cache if necessary. Updating Y.config directly
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * will not update the cache.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @method applyConfig
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @param {object} the configuration object.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @since 3.2.0
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith applyConfig: function(o) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith for (name in o) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith // preserve the guid
998276643802ff9fb197fe220cbd9552da00a624Luke Smith _config: function(o) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * Initialize this YUI instance
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith _init: function() {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * The version number of the YUI instance.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @property version
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @type string
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith // bootstrapped: false,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith // get from querystring
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith nodes = (doc && doc.getElementsByTagName('script')) || [];
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith // this is to set up the path to the loader. The file
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith // filter for loader should match the yui include.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith // extract correct path for mixed combo urls
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith // http://yuilibrary.com/projects/yui3/ticket/2528423
998276643802ff9fb197fe220cbd9552da00a624Luke Smith // use CDN default
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith // configuration defaults
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith Y.Env.getBase(/^(.*)yui\/yui([\.\-].*)js(\?.*)?$/,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith if (!filter || (!('-min.-debug.').indexOf(filter))) {
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * Finishes the instance setup. Attaches whatever modules were defined
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * when the yui modules was registered.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @method _setup
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith _setup: function(o) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith var i, Y = this,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith 'intl-base',
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith 'yui-later',
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith 'yui-throttle'];
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * Executes a method on a YUI instance with
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * the specified id if the specified method is whitelisted.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @method applyTo
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @param id {string} the YUI instance id.
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * @param method {string} the name of the method to exectute.
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * Ex: 'Object.keys'.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @param args {Array} the arguments to apply to the method.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @return {object} the return value from the applied method or null.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith this.log(method + ': applyTo not allowed', 'warn', 'yui');
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith return null;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith this.log('applyTo not found: ' + method, 'warn', 'yui');
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith return null;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * Registers a module with the YUI global. The easiest way to create a
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * first-class YUI module is to use the YUI component build tool.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * The build system will produce the YUI.add wrapper for you module, along
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * with any configuration info required for the module.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @method add
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @param name {string} module name.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @param fn {Function} entry point into the module that
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * is used to bind module to the YUI instance.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @param version {string} version string.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @param details {object} optional config data:
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * requires: features that must be present before this module can be
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * optional: optional features that should be present if loadOptional
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * is defined. Note: modules are not often loaded this way in YUI 3,
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * but this field is still useful to inform the user that certain
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * features in the component will require additional dependencies.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * use: features that are included within this module which need to
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * be attached automatically when this module is attached. This
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * supports the YUI 3 rollup system -- a module with submodules
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * defined will need to have the submodules listed in the 'use'
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * config. The YUI component build tool does this for you.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @return {YUI} the YUI instance.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith return this;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * Executes the function associated with each required
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * module, binding the module to the YUI instance.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @method _attach
998276643802ff9fb197fe220cbd9552da00a624Luke Smith Y = this, j,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith if (!done[r[i]]) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith return false;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith return false;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith } catch (e) {
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith return false;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith return false;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith return true;
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * Attaches one or more modules to the YUI instance. When this
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * is executed, the requirements are analyzed, and one of
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * several things can happen:
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * - All requirements are available on the page -- The modules
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * are attached to the instance. If supplied, the use callback
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * is executed synchronously.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * - Modules are missing, the Get utility is not available OR
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * the 'bootstrap' config is false -- A warning is issued about
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * the missing modules and all available modules are attached.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * - Modules are missing, the Loader is not available but the Get
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * utility is and boostrap is not false -- The loader is bootstrapped
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * before doing the following....
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * - Modules are missing and the Loader is available -- The loader
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * expands the dependency tree and fetches missing modules. When
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * the loader is finshed the callback supplied to use is executed
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * asynchronously.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @param modules* {string} 1-n modules to bind (uses arguments array).
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @param *callback {function} callback function executed when
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * the instance has the required functionality. If included, it
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * must be the last parameter.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * // loads and attaches drag and drop and its dependencies
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * YUI().use('dd', function(Y) {});
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * // attaches all modules that are available on the page
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * YUI().use('*', function(Y) {});
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * // intrinsic YUI gallery support (since 3.1.0)
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * YUI().use('gallery-yql', function(Y) {});
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * // intrinsic YUI 2in3 support (since 3.1.0)
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * YUI().use('yui2-datatable', function(Y) {});.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith * @return {YUI} the YUI instance.
8c0728da50e402de1837852ea5482ccd74c230f7Luke Smith use: function() {
998276643802ff9fb197fe220cbd9552da00a624Luke Smith // The last argument supplied to use can be a load complete callback
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // key = args.join();
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // if (Y.config.cacheUse && Y.Env.serviced[key]) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // Y._notify(callback, ALREADY_DONE, args);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith info = Env._loader && Env._loader.moduleInfo[name];
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // if (Y.config.cacheUse) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // Y.Env.serviced[key] = true;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith if (!response.success && this.config.loadErrorFn) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith this.config.loadErrorFn.call(this, this, callback, response, args);
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith } else if (callback) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith } catch (e) {
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith if (!this.Array) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // add this module to full list of things to attach
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // only attach a module once
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // CSS files don't register themselves, see if it has
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // been loaded
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith // make sure requirements are attached
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // make sure we grab the submodule dependencies too
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith if (Y._useQueue && Y._useQueue.size() && !Y._loading) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // YUI().use('*'); // bind everything available
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // use loader to expand dependencies and sort the
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // requirements if it is available.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith loader.calculate(null, (fetchCSS) ? null : 'js');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // process each requirement and any additional requirements
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // the module metadata specifies
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // dynamic load
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // loader.partial(missing, (fetchCSS) ? null : 'js');
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // server side loader service
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith onEnd: function(o) {
998276643802ff9fb197fe220cbd9552da00a624Luke Smith } else if (boot && len && Y.Get && !Env.bootstrapped) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith handleBoot = function() {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Returns the namespace specified and creates it if it doesn't exist
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * YUI.namespace("property.package");
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * YUI.namespace("YAHOO.property.package");
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Either of the above would create YUI.property, then
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * YUI.property.package (YAHOO is scrubbed out, this is
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * to remain compatible with YUI2)
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Be careful when naming packages. Reserved words may work in some browsers
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * and not others. For instance, the following will fail in Safari:
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * YUI.namespace("really.long.nested.namespace");
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * This fails because "long" is a future reserved word in ECMAScript
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @method namespace
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @param {string*} arguments 1-n namespaces to create.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @return {object} A reference to the last namespace object created.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith namespace: function() {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith for (; i < a.length; i++) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // d = ('' + a[i]).split('.');
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith for (j = (d[0] == 'YAHOO') ? 1 : 0; j < d.length; j++) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith o[d[j]] = o[d[j]] || {};
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith o = o[d[j]];
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith // this is replaced if the log module is included
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Report an error. The reporting mechanism is controled by
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * the 'throwFail' configuration attribute. If throwFail is
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * not specified, the message is written to the Logger, otherwise
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * a JS error is thrown
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @method error
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @param msg {string} the error message.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @param e {Error|string} Optional JS error that was caught, or an error string.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @param data Optional additional info
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * and throwFail is specified, this error will be re-thrown.
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * @return {YUI} this YUI instance.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var Y = this, ret;
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Generate an id that is unique among all YUI instances
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @method guid
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @param pre {string} optional guid prefix.
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * @return {string} the guid.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Returns a guid associated with an object. If the object
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * does not have one, a new one is created unless readOnly
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * is specified.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @method stamp
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @param o The object to stamp.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @param readOnly {boolean} if true, a valid guid will only
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * be returned if the object has one assigned to it.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @return {string} The object's guid or null.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // IE generates its own unique ID for dom nodes
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // The uniqueID property of a document node returns a new ID
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith if (o.uniqueID && o.nodeType && o.nodeType !== 9) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith } catch (e) {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Destroys the YUI instance
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @method destroy
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * @since 3.3.0
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith destroy: function() {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith var Y = this;
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * instanceof check for objects that works around
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * memory leak in IE when the item tested is
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @method instanceOf
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @since 3.3.0
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // inheritance utilities are not available yet
998276643802ff9fb197fe220cbd9552da00a624Luke Smith // set up the environment
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // add a window load event at load time so we can capture
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // the case where it fires before dynamic loading is
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith // complete.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith /*global exports*/
998276643802ff9fb197fe220cbd9552da00a624Luke Smith // Support the CommonJS method for exporting our single global
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * The config object contains all of the configuration options for
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * the YUI instance. This object is supplied by the implementer
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * when instantiating a YUI instance. Some properties have default
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * values if they are not supplied by the implementer. This should
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * not be updated directly because some values are cached. Use
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * applyConfig() to update the config object on a YUI instance that
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * has already been configured.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @class config
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Allows the YUI seed file to fetch the loader component and library
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * metadata to dynamically load additional dependencies.
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * @property bootstrap
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * @type boolean
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @default true
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Log to the browser console if debug is on and the browser has a
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * supported console.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property useBrowserConsole
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type boolean
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @default true
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * A hash of log sources that should be logged. If specified, only
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * log messages from these sources will be logged.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property logInclude
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type object
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * A hash of log sources that should be not be logged. If specified,
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * all sources are logged if not on this list.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property logExclude
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type object
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Set to true if the yui seed file was dynamically loaded in
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * order to bootstrap components relying on the window load event
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * and the 'domready' custom event.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property injected
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * @type boolean
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @default false
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * If throwFail is set, Y.error will generate or re-throw a JS Error.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Otherwise the failure is logged.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property throwFail
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type boolean
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @default true
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * The window/frame that this instance should operate in.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property win
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type Window
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @default the window hosting YUI
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * The document associated with the 'win' configuration.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property doc
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * @type Document
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @default the document hosting YUI
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * A list of modules that defines the YUI core (overrides the default).
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property core
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type string[]
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * A list of languages in order of preference. This list is matched against
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * the list of available languages in modules that the YUI instance uses to
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * determine the best possible localization of language sensitive modules.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Languages are represented using BCP 47 language tags, such as "en-GB" for
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * English as used in the United Kingdom, or "zh-Hans-CN" for simplified
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Chinese as used in China. The list can be provided as a comma-separated
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * list or as an array.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property lang
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type string|string[]
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * The default date format
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property dateFormat
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type string
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @deprecated use configuration in DataType.Date.format() instead.
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * The default locale
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * @property locale
15ddc967c5d429ed2983719db23b453794ab0338Luke Smith * @type string
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * @deprecated use config.lang instead.
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * The default interval when polling in milliseconds.
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * @property pollInterval
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * @default 20
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * The number of dynamic nodes to insert by default before
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * automatically removing them. This applies to script nodes
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * because remove the node will not make the evaluated script
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * unavailable. Dynamic CSS is not auto purged, because removing
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * a linked style sheet will also remove the style definitions.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property purgethreshold
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @default 20
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * The default interval when polling in milliseconds.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property windowResizeDelay
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @default 40
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * Base directory for dynamic loading
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * @property base
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * @type string
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * The secure base dir (not implemented)
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * For dynamic loading.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property secureBase
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type string
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * The YUI combo service base dir. Ex: http://yui.yahooapis.com/combo?
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * For dynamic loading.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property comboBase
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type string
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * The root path to prepend to module path for the combo service.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * For dynamic loading.
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * @property root
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * @type string
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * A filter to apply to result urls. This filter will modify the default
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * path for all modules. The default path for the YUI library is the
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * minified version of the files (e.g., event-min.js). The filter property
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * can be a predefined filter or a custom filter. The valid predefined
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * filters are:
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * <dt>DEBUG</dt>
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * <dd>Selects the debug versions of the library (e.g., event-debug.js).
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * This option will automatically include the Logger widget</dd>
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * <dt>RAW</dt>
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * <dd>Selects the non-minified version of the library (e.g., event.js).</dd>
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * You can also define a custom filter, which must be an object literal
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * containing a search expression and a replace string:
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * myFilter: {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * 'searchExp': "-min\\.js",
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * 'replaceStr': "-debug.js"
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * For dynamic loading.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property filter
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type string|object
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * The 'skin' config let's you configure application level skin
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * customizations. It contains the following attributes which
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * can be specified to override the defaults:
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * // The default skin, which is automatically applied if not
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * // overriden by a component-specific skin definition.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * // Change this in to apply a different skin globally
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * defaultSkin: 'sam',
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * // This is combined with the loader base property to get
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * // the default root directory for a skin.
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * // Any component-specific overrides can be specified here,
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * // making it possible to load different skins for different
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * // components. It is possible to load more than one skin
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * // for a given component as well.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * overrides: {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * slider: ['capsule', 'round']
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * For dynamic loading.
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * @property skin
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Hash of per-component filter specification. If specified for a given
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * component, this overrides the filter config.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * For dynamic loading.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property filters
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Use the YUI combo service to reduce the number of http connections
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * required to load your dependencies. Turning this off will
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * disable combo handling for YUI and all module groups configured
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * with a combo service.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * For dynamic loading.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property combine
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type boolean
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @default true if 'base' is not supplied, false if it is.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * A list of modules that should never be dynamically loaded
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property ignore
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type string[]
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * A list of modules that should always be loaded when required, even if already
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * present on the page.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property force
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type string[]
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Node or id for a node that should be used as the insertion point for new
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * nodes. For dynamic loading.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property insertBefore
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type string
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Object literal containing attributes to add to dynamically loaded script
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property jsAttributes
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type string
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Object literal containing attributes to add to dynamically loaded link
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property cssAttributes
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type string
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Number of milliseconds before a timeout occurs when dynamically
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * loading nodes. If not set, there is no timeout.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property timeout
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * Callback for the 'CSSComplete' event. When dynamically loading YUI
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * components with CSS, this property fires when the CSS is finished
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * loading but script loading is still ongoing. This provides an
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * opportunity to enhance the presentation of a loading page a little
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * bit before the entire loading process is done.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property onCSS
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type function
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * A hash of module definitions to add to the list of YUI components.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * These components can then be dynamically loaded side by side with
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * YUI via the use() method. This is a hash, the key is the module
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * name, and the value is an object literal specifying the metdata
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * for the module. * See Loader.addModule for the supported module
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * metadata fields. Also @see groups, which provides a way to
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * configure the base and combo spec for a set of modules.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * modules: {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * mymod1: {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * requires: ['node'],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * fullpath: 'http://myserver.mydomain.com/mymod1/mymod1.js'
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * mymod2: {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * requires: ['mymod1'],
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * fullpath: 'http://myserver.mydomain.com/mymod2/mymod2.js'
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property modules
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type object
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * A hash of module group definitions. It for each group you
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * can specify a list of modules and the base path and
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * combo spec to use when dynamically loading the modules. @see
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @see modules for the details about the modules part of the
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * group definition.
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * groups: {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * yui2: {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * // specify whether or not this group has a combo service
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * combine: true,
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * // the base path for non-combo paths
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * base: 'http://yui.yahooapis.com/2.8.0r4/build/',
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * // the path to the combo service
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * comboBase: 'http://yui.yahooapis.com/combo?',
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * // a fragment to prepend to the path attribute when
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * // when building combo urls
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * root: '2.8.0r4/build/',
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * // the module definitions
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * modules: {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * yui2_yde: {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * path: "yahoo-dom-event/yahoo-dom-event.js"
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * yui2_anim: {
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * path: "animation/animation.js",
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * requires: ['yui2_yde']
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @property modules
45c60cccb9510ac1984b981c475511ad657f1116Luke Smith * @type object
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * The loader 'path' attribute to the loader itself. This is combined
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * with the 'base' attribute to dynamically load the loader component
998276643802ff9fb197fe220cbd9552da00a624Luke Smith * when boostrapping with the get utility alone.
* @default loader/loader-min.js
var L = Y.Lang,
TYPES = {
TRIMREGEX = /^\s+|\s+$/g,
SUBREGEX = /\{\s*([^\|\}]+?)\s*(?:\|([^\}]*))?\s*\}/g;
L.isArray = function(o) {
L.isBoolean = function(o) {
return typeof o === BOOLEAN;
L.isFunction = function(o) {
L.isDate = function(o) {
L.isNull = function(o) {
L.isNumber = function(o) {
return (o && (t === OBJECT ||
L.isString = function(o) {
return typeof o === STRING;
L.isUndefined = function(o) {
return typeof o === UNDEFINED;
return s.trimLeft();
return s.trimRight();
L.isValue = function(o) {
var t = L.type(o);
case NUMBER:
return isFinite(o);
case NULL:
case UNDEFINED:
L.type = function(o) {
L.sub = function(s, o) {
return new Date().getTime();
l = o.length;
Y.Array = YArray;
f.call(o || Y, a[i], i, a);
function(a, val) {
function(a, val) {
if (a[i] === val) {
var l = a.length, i;
if (f.call(o, a[i], i, a)) {
function Queue() {
this._init();
_init: function() {
this._q = [];
next: function() {
last: function() {
add: function() {
size: function() {
_iefix = function(r, s) {
Y.merge = function() {
Y.mix(o, a[i], true);
* @param merge {boolean/int} merge objects instead of overwriting/ignoring.
if (mode) {
switch (mode) {
var i, l, p, type;
p = wl[i];
if (s.hasOwnProperty(p)) {
Y.mix(r[p], s[p]);
} else if (ov || !(p in r)) {
if (s.hasOwnProperty(i)) {
} else if (ov || !(i in r)) {
_iefix(r, s);
return function(arg1) {
return cache[k];
F.prototype = o;
owns = function(o, k) {
if (owns(o, i)) {
if (count) {
out++;
return out;
O.keys = function(o) {
return _extract(o);
O.values = function(o) {
O.hasValue = function(o, v) {
f.call(s, o[i], i, o);
if (f.call(s, o[i], i, o)) {
return UNDEF;
p = Y.Array(path),
l = p.length;
p = Y.Array(path),
ref = o;
return UNDEF;
O.isEmpty = function(o) {
if (owns(o, i)) {
var numberify = function(s) {
mobile: null,
ios: null,
secure: false,
os: null
if (ua) {
o.ios = m;