yui-core-debug.js revision 71651656e38f39cf8f088e75166fb0bf51c52eb1
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * The YUI module contains the components required for building the YUI seed
dad6cdf976d1a75918d0d66731bb1b916a29b1fdvboxsync * file. This includes the script loading mechanism, a simple queue, and
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * the core utilities for the library.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * @module yui
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * @submodule yui-base
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsyncThe YUI global namespace object. If YUI is already defined, the
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsyncexisting YUI object will not be overwritten so that defined
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsyncnamespaces are preserved. It is the constructor for the object
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsyncthe end user interacts with. As indicated below, each instance
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsynchas full custom event support, but only if the event system
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsyncis available. This is a self-instantiable factory function. You
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsynccan invoke it directly like this:
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync YUI().use('*', function(Y) {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsyncBut it also works like this:
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync var Y = YUI();
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync@constructor
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync@uses EventTarget
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync@param o* {object} 0..n optional configuration objects. these values
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsyncare store in Y.config. See <a href="config.html">Config</a> for the list of supported
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync /*global YUI*/
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync /*global YUI_config*/
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync var YUI = function() {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync return (o && o.hasOwnProperty && (o instanceof type));
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync gconf = (typeof YUI_config !== 'undefined') && YUI_config;
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // set up the core environment
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync YUI.GlobalConfig is a master configuration that might span
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync multiple contexts in a non-browser environment. It is applied
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync first to all instances in all contexts.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync @property YUI.GlobalConfig
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync @type {Object}
22e5e79c3462b52f8da631a7b92f82ed03550d52vboxsync YUI.GlobalConfig = {
dad6cdf976d1a75918d0d66731bb1b916a29b1fdvboxsync filter: 'debug'
dad6cdf976d1a75918d0d66731bb1b916a29b1fdvboxsync YUI().use('node', function(Y) {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync //debug files used here
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync filter: 'min'
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync }).use('node', function(Y) {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync //min files used here
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync YUI_config is a page-level config. It is applied to all
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync instances created on the page. This is applied after
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync YUI.GlobalConfig, and before the instance level configuration
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync @property YUI_config
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync @type {Object}
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync //Single global var to include before YUI seed file
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync YUI_config = {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync filter: 'debug'
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync YUI().use('node', function(Y) {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync //debug files used here
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync filter: 'min'
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync }).use('node', function(Y) {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync //min files used here
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // bind the specified additional modules for this instance
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // Each instance can accept one or more configuration objects.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // These are applied after YUI.GlobalConfig and YUI_Config,
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // overriding values set in those config files if there is a '
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // matching property.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync for (; i < l; i++) {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync(function() {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync NOOP = function() {},
949fa097f20d6eed3c7d43598a41900ec11d70aevboxsync APPLY_TO_AUTH = { 'io.xdrReady': 1, // the functions applyTo
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // this can throw an uncaught exception in FF
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync } catch (ex) {}
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync handleLoad = function() {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync getLoader = function(Y, o) {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync //loader._config(Y.config);
dad6cdf976d1a75918d0d66731bb1b916a29b1fdvboxsync clobber = function(r, s) {
dad6cdf976d1a75918d0d66731bb1b916a29b1fdvboxsync for (var i in s) {
447cbf113f44132911fc13dc33cb26603759b82evboxsync r[i] = s[i];
daac39eba667f9e64b03ef08bb5cd7c965cd72c2vboxsync// Stamp the documentElement (HTML) with a class of "yui-loaded" to
dad6cdf976d1a75918d0d66731bb1b916a29b1fdvboxsync// enable styles that need to key off of JS being enabled.
dad6cdf976d1a75918d0d66731bb1b916a29b1fdvboxsync * Applies a new configuration object to the YUI instance config.
daac39eba667f9e64b03ef08bb5cd7c965cd72c2vboxsync * This will merge new group/module definitions, and will also
daac39eba667f9e64b03ef08bb5cd7c965cd72c2vboxsync * update the loader cache if necessary. Updating Y.config directly
dad6cdf976d1a75918d0d66731bb1b916a29b1fdvboxsync * will not update the cache.
447cbf113f44132911fc13dc33cb26603759b82evboxsync * @method applyConfig
447cbf113f44132911fc13dc33cb26603759b82evboxsync * @param {object} o the configuration object.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * @since 3.2.0
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync applyConfig: function(o) {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync for (name in o) {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // preserve the guid
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * Old way to apply a config to the instance (calls `applyConfig` under the hood)
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * @method _config
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * @param {Object} o The config to apply
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync _config: function(o) {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * Initialize this YUI instance
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * @method _init
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync _init: function() {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * The version number of the YUI instance.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * @property version
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * @type string
9a88baf80535828f7e11cd9f9c8796b2bb428ca2vboxsync // bootstrapped: false,
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // serviced: {},
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // Regex in English:
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // I'll start at the \b(simpleyui).
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // 1. Look in the test string for "simpleyui" or "yui" or
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // "yui-base" or "yui-rls" or "yui-foobar" that comes after a word break. That is, it
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // can't match "foyui" or "i_heart_simpleyui". This can be anywhere in the string.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // 2. After #1 must come a forward slash followed by the string matched in #1, so
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // "yui-base/yui-base" or "simpleyui/simpleyui" or "yui-pants/yui-pants".
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // 3. The second occurence of the #1 token can optionally be followed by "-debug" or "-min",
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // so "yui/yui-min", "yui/yui-debug", "yui-base/yui-base-debug". NOT "yui/yui-tshirt".
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // 4. This is followed by ".js", so "yui/yui.js", "simpleyui/simpleyui-min.js"
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // 0. Going back to the beginning, now. If all that stuff in 1-4 comes after a "?" in the string,
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // then capture the junk between the LAST "&" and the string in 1-4. So
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // "blah?foo/yui/yui.js" will capture "foo/" and "blah?some/thing.js&3.3.0/build/yui-rls/yui-rls.js"
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // will capture "3.3.0/build/"
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // Regex Exploded:
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // (?:\? Find a ?
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // (?:[^&]*&) followed by 0..n characters followed by an &
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // * in fact, find as many sets of characters followed by a & as you can
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // ([^&]*) capture the stuff after the last & in \1
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // )? but it's ok if all this ?junk&more_junk stuff isn't even there
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // \b(simpleyui| after a word break find either the string "simpleyui" or
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // yui(?:-\w+)? the string "yui" optionally followed by a -, then more characters
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // ) and store the simpleyui or yui-* string in \2
9e28880ed1afe735e1a11ddd5af1bb8355918b27vboxsync // \/\2 then comes a / followed by the simpleyui or yui-* string in \2
2a0786080a186b4049daadf7b179ae6984107608vboxsync // (?:-(min|debug))? optionally followed by "-min" or "-debug"
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // .js and ending in ".js"
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync _BASE_RE: /(?:\?(?:[^&]*&)*([^&]*))?\b(simpleyui|yui(?:-\w+)?)\/\2(?:-(min|debug))?\.js/,
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync path = RegExp.leftContext || src.slice(0, src.indexOf(match[0]));
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // this is to set up the path to the loader. The file
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // filter for loader should match the yui include.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // extract correct path for mixed combo urls
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // http://yuilibrary.com/projects/yui3/ticket/2528423
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync var nodes = (doc && doc.getElementsByTagName('script')) || [],
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // use CDN default
65c46326177819a2479fa19862d415edc3d5c615vboxsync // configuration defaults
f91efc1ea08b5174ddbf71ce0bff708e319349bfvboxsync Y.config.base = YUI.config.base || Y.Env.getBase(Y.Env._BASE_RE);
f91efc1ea08b5174ddbf71ce0bff708e319349bfvboxsync Y.config.loaderPath = YUI.config.loaderPath || 'loader/loader' + filter + '.js';
f91efc1ea08b5174ddbf71ce0bff708e319349bfvboxsync * Finishes the instance setup. Attaches whatever modules were defined
f91efc1ea08b5174ddbf71ce0bff708e319349bfvboxsync * when the yui modules was registered.
f91efc1ea08b5174ddbf71ce0bff708e319349bfvboxsync * @method _setup
f91efc1ea08b5174ddbf71ce0bff708e319349bfvboxsync _setup: function(o) {
f91efc1ea08b5174ddbf71ce0bff708e319349bfvboxsync var i, Y = this,
65c46326177819a2479fa19862d415edc3d5c615vboxsync // Y.log(Y.id + ' initialized', 'info', 'yui');
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * Executes a method on a YUI instance with
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * the specified id if the specified method is whitelisted.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * @method applyTo
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * @param id {String} the YUI instance id.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * @param method {String} the name of the method to exectute.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * Ex: 'Object.keys'.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * @param args {Array} the arguments to apply to the method.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * @return {Object} the return value from the applied method or null.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync this.log(method + ': applyTo not allowed', 'warn', 'yui');
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync return null;
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync this.log('applyTo not found: ' + method, 'warn', 'yui');
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync return null;
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsyncRegisters a module with the YUI global. The easiest way to create a
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsyncfirst-class YUI module is to use the YUI component build tool.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsyncThe build system will produce the `YUI.add` wrapper for you module, along
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsyncwith any configuration info required for the module.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync@param name {String} module name.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync@param fn {Function} entry point into the module that is used to bind module to the YUI instance.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync@param {YUI} fn.Y The YUI instance this module is executed in.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync@param {String} fn.name The name of the module
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync@param version {String} version string.
adad4c53ebf3692881e3054c02d2ff6494912deevboxsync@param details {Object} optional config data:
9a21b0b6af798a6465c28a5ab9d9b1c3b07b974cvboxsync@param details.requires {Array} features that must be present before this module can be attached.
9a21b0b6af798a6465c28a5ab9d9b1c3b07b974cvboxsync@param details.optional {Array} optional features that should be present if loadOptional
9a21b0b6af798a6465c28a5ab9d9b1c3b07b974cvboxsync is defined. Note: modules are not often loaded this way in YUI 3,
9a21b0b6af798a6465c28a5ab9d9b1c3b07b974cvboxsync but this field is still useful to inform the user that certain
9a21b0b6af798a6465c28a5ab9d9b1c3b07b974cvboxsync features in the component will require additional dependencies.
9a21b0b6af798a6465c28a5ab9d9b1c3b07b974cvboxsync@param details.use {Array} features that are included within this module which need to
9a21b0b6af798a6465c28a5ab9d9b1c3b07b974cvboxsync be attached automatically when this module is attached. This
9a21b0b6af798a6465c28a5ab9d9b1c3b07b974cvboxsync supports the YUI 3 rollup system -- a module with submodules
9a21b0b6af798a6465c28a5ab9d9b1c3b07b974cvboxsync defined will need to have the submodules listed in the 'use'
9a21b0b6af798a6465c28a5ab9d9b1c3b07b974cvboxsync config. The YUI component build tool does this for you.
adad4c53ebf3692881e3054c02d2ff6494912deevboxsync@return {YUI} the YUI instance.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync YUI.add('davglass', function(Y, name) {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync Y.davglass = function() {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync alert('Dav was here!');
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync }, '3.4.0', { requires: ['yui-base', 'harley-davidson', 'mt-dew'] });
a1a0588b89dd0e8ecad7a024ef8cb8b0ac518156vboxsync return this;
c53fd76cb229897343a9f1b32fc1187d8009de38vboxsync * Executes the function associated with each required
c53fd76cb229897343a9f1b32fc1187d8009de38vboxsync * module, binding the module to the YUI instance.
c53fd76cb229897343a9f1b32fc1187d8009de38vboxsync * @method _attach
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync Y = this, j,
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync //console.info('attaching: ' + r, 'info', 'yui');
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync if (!done[r[i]]) {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync // Y.log('no js def for: ' + name, 'info', 'yui');
fae4adece685167d2bfded7360230eb35366aeadvboxsync //if (!loader || !loader.moduleInfo[name]) {
dad6cdf976d1a75918d0d66731bb1b916a29b1fdvboxsync //if ((!loader || !loader.moduleInfo[name]) && !moot) {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync //Don't like this, but in case a mod was asked for once, then we fetch it
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync //We need to remove it from the missed list
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync Y.message('Found: ' + name + ' (was reported as missing earlier)', 'warn', 'yui');
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync return false;
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync return false;
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync } catch (e) {
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync return false;
91b3ad12b6cac90efc3b65eeffba7241cdb15edavboxsync return false;
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync return true;
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * Attaches one or more modules to the YUI instance. When this
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * is executed, the requirements are analyzed, and one of
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * several things can happen:
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * * All requirements are available on the page -- The modules
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * are attached to the instance. If supplied, the use callback
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * is executed synchronously.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * * Modules are missing, the Get utility is not available OR
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * the 'bootstrap' config is false -- A warning is issued about
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * the missing modules and all available modules are attached.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * * Modules are missing, the Loader is not available but the Get
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * utility is and boostrap is not false -- The loader is bootstrapped
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * before doing the following....
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * * Modules are missing and the Loader is available -- The loader
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * expands the dependency tree and fetches missing modules. When
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * the loader is finshed the callback supplied to use is executed
5999df4de51c716ca922e268c4b0d60beeb51ac6vboxsync * asynchronously.
5999df4de51c716ca922e268c4b0d60beeb51ac6vboxsync * @method use
5999df4de51c716ca922e268c4b0d60beeb51ac6vboxsync * @param modules* {String} 1-n modules to bind (uses arguments array).
5999df4de51c716ca922e268c4b0d60beeb51ac6vboxsync * @param *callback {Function} callback function executed when
5999df4de51c716ca922e268c4b0d60beeb51ac6vboxsync * the instance has the required functionality. If included, it
5999df4de51c716ca922e268c4b0d60beeb51ac6vboxsync * must be the last parameter.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * // loads and attaches dd and its dependencies
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * YUI().use('dd', function(Y) {});
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * // loads and attaches dd and node as well as all of their dependencies (since 3.4.0)
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * YUI().use(['dd', 'node'], function(Y) {});
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * // attaches all modules that are available on the page
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * YUI().use('*', function(Y) {});
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * // intrinsic YUI gallery support (since 3.1.0)
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * YUI().use('gallery-yql', function(Y) {});
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * // intrinsic YUI 2in3 support (since 3.1.0)
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * YUI().use('yui2-datatable', function(Y) {});
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync * @return {YUI} the YUI instance.
febf3f1de573e25fb134b8453a22b0732b4c52e2vboxsync use: function() {
447cbf113f44132911fc13dc33cb26603759b82evboxsync // The last argument supplied to use can be a load complete callback
447cbf113f44132911fc13dc33cb26603759b82evboxsync Y.log('already provisioned: ' + args, 'info', 'yui');
447cbf113f44132911fc13dc33cb26603759b82evboxsync Y.log('already provisioned: ' + args, 'info', 'yui');
447cbf113f44132911fc13dc33cb26603759b82evboxsync * Notify handler from Loader for attachment/load errors
447cbf113f44132911fc13dc33cb26603759b82evboxsync * @method _notify
447cbf113f44132911fc13dc33cb26603759b82evboxsync * @param callback {Function} The callback to pass to the `Y.config.loadErrorFn`
dad6cdf976d1a75918d0d66731bb1b916a29b1fdvboxsync * @param response {Object} The response returned from Loader
b31d6eb6e369ce51f3e51de2e651319333451403vboxsync * @param args {Array} The aruments passed from Loader
dad6cdf976d1a75918d0d66731bb1b916a29b1fdvboxsync if (!response.success && this.config.loadErrorFn) {
447cbf113f44132911fc13dc33cb26603759b82evboxsync this.config.loadErrorFn.call(this, this, callback, response, args);
447cbf113f44132911fc13dc33cb26603759b82evboxsync } else if (callback) {
447cbf113f44132911fc13dc33cb26603759b82evboxsync } catch (e) {
dad6cdf976d1a75918d0d66731bb1b916a29b1fdvboxsync * This private method is called from the `use` method queue. To ensure that only one set of loading
dad6cdf976d1a75918d0d66731bb1b916a29b1fdvboxsync * logic is performed at a time.
447cbf113f44132911fc13dc33cb26603759b82evboxsync * @method _use
447cbf113f44132911fc13dc33cb26603759b82evboxsync * @param args* {String} 1-n modules to bind (uses arguments array).
447cbf113f44132911fc13dc33cb26603759b82evboxsync * @param *callback {Function} callback function executed when
447cbf113f44132911fc13dc33cb26603759b82evboxsync * the instance has the required functionality. If included, it
447cbf113f44132911fc13dc33cb26603759b82evboxsync * must be the last parameter.
447cbf113f44132911fc13dc33cb26603759b82evboxsync if (!this.Array) {
447cbf113f44132911fc13dc33cb26603759b82evboxsync // add this module to full list of things to attach
dad6cdf976d1a75918d0d66731bb1b916a29b1fdvboxsync // only attach a module once
af7209255033c3b77816f81ef6293ff8070ee156vboxsync // CSS files don't register themselves, see if it has
af7209255033c3b77816f81ef6293ff8070ee156vboxsync // been loaded
af7209255033c3b77816f81ef6293ff8070ee156vboxsync // make sure requirements are attached
af7209255033c3b77816f81ef6293ff8070ee156vboxsync // make sure we grab the submodule dependencies too
b611b9aef058a4d56b211e69026abf3500bf74c3vboxsync Y.log('Nested use callback: ' + data, 'info', 'yui');
b611b9aef058a4d56b211e69026abf3500bf74c3vboxsync // Y.log('attaching from loader: ' + data, 'info', 'yui');
b611b9aef058a4d56b211e69026abf3500bf74c3vboxsync if (Y._useQueue && Y._useQueue.size() && !Y._loading) {
b611b9aef058a4d56b211e69026abf3500bf74c3vboxsync// Y.log(Y.id + ': use called: ' + a + ' :: ' + callback, 'info', 'yui');
b611b9aef058a4d56b211e69026abf3500bf74c3vboxsync // YUI().use('*'); // bind everything available
b611b9aef058a4d56b211e69026abf3500bf74c3vboxsync // Y.log('before loader requirements: ' + args, 'info', 'yui');
599595881adeaefb423b996cf29e21e5831c26d7vboxsync // use loader to expand dependencies and sort the
if (len) {
Y._loading = true;
var rls_end = function(o) {
handleLoader(o);
if (rls_url) {
rls_end(o);
rls_end({
success: true,
Y._loading = true;
handleBoot = function() {
Y._loading = false;
if (ret) {
handleLoader();
namespace: function() {
for (; i < a.length; i++) {
arg = a[i];
var Y = this, ret;
var uid;
if (!uid) {
if (!readOnly) {
uid = null;
return uid;
destroy: function() {
if (Y.Event) {
delete Y.Env;
delete Y.config;
if (hasWin) {
handleLoad();
* The YUI combo service base dir. Ex: `http://yui.yahooapis.com/combo?`
* minified version of the files (e.g., event-min.js). The filter property
* <dd>Selects the debug versions of the library (e.g., event-debug.js).
* <dd>Selects the non-minified version of the library (e.g., event.js).</dd>
* 'replaceStr': "-debug.js"
* fullpath: 'http://myserver.mydomain.com/mymod1/mymod1.js'
* fullpath: 'http://myserver.mydomain.com/mymod2/mymod2.js'
* base: 'http://yui.yahooapis.com/2.8.0r4/build/',
* comboBase: 'http://yui.yahooapis.com/combo?',
* path: "yahoo-dom-event/yahoo-dom-event.js"
* path: "animation/animation.js",
* @default loader/loader-min.js
TYPES = {
SUBREGEX = /\{\s*([^|}]+?)\s*(?:\|([^}]*))?\s*\}/g,
TRIMREGEX = /^\s+|\s+$/g,
L.isBoolean = function(o) {
L.isFunction = function(o) {
L.isDate = function(o) {
L.isNull = function(o) {
L.isNumber = function(o) {
L.isString = function(o) {
L.isUndefined = function(o) {
return s.trimLeft();
return s.trimRight();
L.isValue = function(o) {
var t = L.type(o);
return isFinite(o);
L.type = function(o) {
L.sub = function(s, o) {
return new Date().getTime();
} catch (ex) {
result = [];
return result;
return [thing];
Y.Array = YArray;
} catch (ex) {}
return result;
var hash = {},
results = [],
return results;
if (i in array) {
var hash = {},
i, len;
if (i in keys) {
return hash;
function Queue() {
this._init();
_init: function() {
this._q = [];
next: function() {
last: function() {
add: function() {
size: function() {
return function (arg) {
Y.merge = function () {
result = {};
for (; i < len; ++i) {
return result;
return receiver || Y;
if (mode) {
return receiver;
if (whitelist) {
if (Y.Object._hasEnumBug) {
return receiver;
return function (obj) {
* - <https://developer.mozilla.org/en/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug>
var keys = [],
if (hasEnumBug) {
return keys;
values = [];
for (; i < len; ++i) {
return values;
var key;
var key;
return UNDEFINED;
p = Y.Array(path),
l = p.length;
p = Y.Array(path),
ref = o;
return UNDEFINED;
var numberify = function(s) {
mobile: null,
ios: null,
secure: false,
os: null
if (ua) {
o.ios = m;
"anim": ["anim-base","anim-color","anim-curve","anim-easing","anim-node-plugin","anim-scroll","anim-xy"],
"autocomplete": ["autocomplete-base","autocomplete-sources","autocomplete-list","autocomplete-plugin"],
"dataschema": ["dataschema-base","dataschema-json","dataschema-xml","dataschema-array","dataschema-text"],
"datasource": ["datasource-local","datasource-io","datasource-get","datasource-function","datasource-cache","datasource-jsonschema","datasource-xmlschema","datasource-arrayschema","datasource-textschema","datasource-polling"],
"dd": ["dd-ddm-base","dd-ddm","dd-ddm-drop","dd-drag","dd-proxy","dd-constrain","dd-drop","dd-scroll","dd-delegate"],
"editor": ["frame","selection","exec-command","editor-base","editor-para","editor-br","editor-bidi","editor-tab","createlink-base"],