yui-nodejs-debug.js revision 82816f9b20cc46168c8a554eb8294fb1ff624538
0fdefaa9ca017edfb76b736c825b34186f33045aTripp * The YUI module contains the components required for building the YUI seed
0fdefaa9ca017edfb76b736c825b34186f33045aTripp * file. This includes the script loading mechanism, a simple queue, and
0fdefaa9ca017edfb76b736c825b34186f33045aTripp * the core utilities for the library.
0fdefaa9ca017edfb76b736c825b34186f33045aTripp * @module yui
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @submodule yui-base
a89ad754cce3cfc8aee71760e10217b54020360dTrippThe YUI global namespace object. If YUI is already defined, the
a89ad754cce3cfc8aee71760e10217b54020360dTrippexisting YUI object will not be overwritten so that defined
a89ad754cce3cfc8aee71760e10217b54020360dTrippnamespaces are preserved. It is the constructor for the object
a89ad754cce3cfc8aee71760e10217b54020360dTrippthe end user interacts with. As indicated below, each instance
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripphas full custom event support, but only if the event system
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTrippis available. This is a self-instantiable factory function. You
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTrippcan invoke it directly like this:
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp YUI().use('*', function(Y) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTrippBut it also works like this:
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp var Y = YUI();
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTrippConfiguring the YUI object:
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp debug: true,
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp combine: false
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp }).use('node', function(Y) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp //Node is ready to use
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTrippSee the API docs for the <a href="config.html">Config</a> class
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTrippfor the complete list of supported configuration properties accepted
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTrippby the YUI constuctor.
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp@constructor
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp@uses EventTarget
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp@param [o]* {Object} 0..n optional configuration objects. these values
a89ad754cce3cfc8aee71760e10217b54020360dTrippare store in Y.config. See <a href="config.html">Config</a> for the list of supported
a89ad754cce3cfc8aee71760e10217b54020360dTripp /*global YUI*/
c093c1aed867e18aa4778708592e1ceb45d18cffTripp /*global YUI_config*/
a89ad754cce3cfc8aee71760e10217b54020360dTripp var YUI = function() {
a89ad754cce3cfc8aee71760e10217b54020360dTripp return (o && o.hasOwnProperty && (o instanceof type));
a89ad754cce3cfc8aee71760e10217b54020360dTripp gconf = (typeof YUI_config !== 'undefined') && YUI_config;
a89ad754cce3cfc8aee71760e10217b54020360dTripp Y = new YUI();
a89ad754cce3cfc8aee71760e10217b54020360dTripp // set up the core environment
a89ad754cce3cfc8aee71760e10217b54020360dTripp YUI.GlobalConfig is a master configuration that might span
a89ad754cce3cfc8aee71760e10217b54020360dTripp multiple contexts in a non-browser environment. It is applied
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp first to all instances in all contexts.
a89ad754cce3cfc8aee71760e10217b54020360dTripp @property GlobalConfig
a89ad754cce3cfc8aee71760e10217b54020360dTripp @type {Object}
a89ad754cce3cfc8aee71760e10217b54020360dTripp YUI.GlobalConfig = {
a89ad754cce3cfc8aee71760e10217b54020360dTripp filter: 'debug'
c093c1aed867e18aa4778708592e1ceb45d18cffTripp YUI().use('node', function(Y) {
a89ad754cce3cfc8aee71760e10217b54020360dTripp //debug files used here
a89ad754cce3cfc8aee71760e10217b54020360dTripp filter: 'min'
a89ad754cce3cfc8aee71760e10217b54020360dTripp }).use('node', function(Y) {
a89ad754cce3cfc8aee71760e10217b54020360dTripp //min files used here
c093c1aed867e18aa4778708592e1ceb45d18cffTripp YUI_config is a page-level config. It is applied to all
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp instances created on the page. This is applied after
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp YUI.GlobalConfig, and before the instance level configuration
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp @property YUI_config
527cf651dc5df871799abd06cf589bca3f3a665fTripp @type {Object}
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp //Single global var to include before YUI seed file
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp YUI_config = {
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp filter: 'debug'
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp YUI().use('node', function(Y) {
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp //debug files used here
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp filter: 'min'
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp }).use('node', function(Y) {
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp //min files used here
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // bind the specified additional modules for this instance
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // Each instance can accept one or more configuration objects.
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // These are applied after YUI.GlobalConfig and YUI_Config,
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // overriding values set in those config files if there is a '
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // matching property.
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp for (; i < l; i++) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp(function() {
c09beb6ef319616edc832f6f6d137350d74096e0Tripp NOOP = function() {},
c09beb6ef319616edc832f6f6d137350d74096e0Tripp APPLY_TO_AUTH = { 'io.xdrReady': 1, // the functions applyTo
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // this can throw an uncaught exception in FF
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp } catch (ex) {}
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp handleLoad = function() {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp getLoader = function(Y, o) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp //loader._config(Y.config);
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp YUI.Env.core = Y.Array.dedupe([].concat(YUI.Env.core, [ 'loader-base', 'loader-rollup', 'loader-yui3' ]));
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp clobber = function(r, s) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp for (var i in s) {
c093c1aed867e18aa4778708592e1ceb45d18cffTripp r[i] = s[i];
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp// Stamp the documentElement (HTML) with a class of "yui-loaded" to
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp// enable styles that need to key off of JS being enabled.
a75ebc38c1de401b679953a9b87bd323f0f48d02Tripp * Applies a new configuration object to the YUI instance config.
a75ebc38c1de401b679953a9b87bd323f0f48d02Tripp * This will merge new group/module definitions, and will also
a89ad754cce3cfc8aee71760e10217b54020360dTripp * update the loader cache if necessary. Updating Y.config directly
a89ad754cce3cfc8aee71760e10217b54020360dTripp * will not update the cache.
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @method applyConfig
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @param {Object} o the configuration object.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @since 3.2.0
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp applyConfig: function(o) {
cec703a844d9691646231634fe709f4ea41d278aTripp for (name in o) {
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp config.doc = config[name] ? config[name].document : null;
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // preserve the guid
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * Old way to apply a config to the instance (calls `applyConfig` under the hood)
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @method _config
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @param {Object} o The config to apply
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp _config: function(o) {
a89ad754cce3cfc8aee71760e10217b54020360dTripp * Initialize this YUI instance
7947db4b7d8682ea81598e3a4283e659a8103be6Tripp * @method _init
a89ad754cce3cfc8aee71760e10217b54020360dTripp _init: function() {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * The version number of the YUI instance.
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @property version
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @type string
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp core: ['get','features','intl-base','yui-log', 'yui-log-nodejs', 'yui-later','loader-base', 'loader-rollup', 'loader-yui3'],
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // bootstrapped: false,
a89ad754cce3cfc8aee71760e10217b54020360dTripp // serviced: {},
a89ad754cce3cfc8aee71760e10217b54020360dTripp // Regex in English:
a89ad754cce3cfc8aee71760e10217b54020360dTripp // I'll start at the \b(simpleyui).
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // 1. Look in the test string for "simpleyui" or "yui" or
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // "yui-base" or "yui-davglass" or "yui-foobar" that comes after a word break. That is, it
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // can't match "foyui" or "i_heart_simpleyui". This can be anywhere in the string.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // 2. After #1 must come a forward slash followed by the string matched in #1, so
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // "yui-base/yui-base" or "simpleyui/simpleyui" or "yui-pants/yui-pants".
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // 3. The second occurence of the #1 token can optionally be followed by "-debug" or "-min",
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // so "yui/yui-min", "yui/yui-debug", "yui-base/yui-base-debug". NOT "yui/yui-tshirt".
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // 4. This is followed by ".js", so "yui/yui.js", "simpleyui/simpleyui-min.js"
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // 0. Going back to the beginning, now. If all that stuff in 1-4 comes after a "?" in the string,
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // then capture the junk between the LAST "&" and the string in 1-4. So
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // "blah?foo/yui/yui.js" will capture "foo/" and "blah?some/thing.js&3.3.0/build/yui-davglass/yui-davglass.js"
117557654069e56f5003be755819b76fe0f77107Tripp // will capture "3.3.0/build/"
117557654069e56f5003be755819b76fe0f77107Tripp // Regex Exploded:
117557654069e56f5003be755819b76fe0f77107Tripp // (?:\? Find a ?
117557654069e56f5003be755819b76fe0f77107Tripp // (?:[^&]*&) followed by 0..n characters followed by an &
117557654069e56f5003be755819b76fe0f77107Tripp // * in fact, find as many sets of characters followed by a & as you can
117557654069e56f5003be755819b76fe0f77107Tripp // ([^&]*) capture the stuff after the last & in \1
117557654069e56f5003be755819b76fe0f77107Tripp // )? but it's ok if all this ?junk&more_junk stuff isn't even there
117557654069e56f5003be755819b76fe0f77107Tripp // \b(simpleyui| after a word break find either the string "simpleyui" or
117557654069e56f5003be755819b76fe0f77107Tripp // yui(?:-\w+)? the string "yui" optionally followed by a -, then more characters
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // ) and store the simpleyui or yui-* string in \2
117557654069e56f5003be755819b76fe0f77107Tripp // \/\2 then comes a / followed by the simpleyui or yui-* string in \2
117557654069e56f5003be755819b76fe0f77107Tripp // (?:-(min|debug))? optionally followed by "-min" or "-debug"
117557654069e56f5003be755819b76fe0f77107Tripp // .js and ending in ".js"
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp _BASE_RE: /(?:\?(?:[^&]*&)*([^&]*))?\b(simpleyui|yui(?:-\w+)?)\/\2(?:-(min|debug))?\.js/,
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp path = RegExp.leftContext || src.slice(0, src.indexOf(match[0]));
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // this is to set up the path to the loader. The file
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // filter for loader should match the yui include.
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // extract correct path for mixed combo urls
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp function(pattern) {
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp var nodes = (doc && doc.getElementsByTagName('script')) || [],
a89ad754cce3cfc8aee71760e10217b54020360dTripp // use CDN default
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // configuration defaults
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp //Register the CSS stamp element
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp el.innerHTML = '<div id="' + CSS_STAMP_EL + '" style="position: absolute !important; visibility: hidden !important"></div>';
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp docEl.insertBefore(YUI.Env.cssStampEl, docEl.firstChild);
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp Y.config.base = YUI.config.base || Y.Env.getBase(Y.Env._BASE_RE);
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp Y.config.loaderPath = YUI.config.loaderPath || 'loader/loader' + filter + '.js';
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * Finishes the instance setup. Attaches whatever modules were defined
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * when the yui modules was registered.
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @method _setup
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp _setup: function(o) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp var i, Y = this,
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp //extras = Y.config.core || ['get','features','intl-base','yui-log', 'yui-log-nodejs', 'yui-later','loader-base', 'loader-rollup', 'loader-yui3'];
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp extras = Y.config.core || [].concat(YUI.Env.core); //Clone it..
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp // Y.log(Y.id + ' initialized', 'info', 'yui');
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * Executes a method on a YUI instance with
6c4ec9d420df654d019b936fd06bef6f769db4cbTripp * the specified id if the specified method is whitelisted.
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * @method applyTo
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * @param id {String} the YUI instance id.
cec703a844d9691646231634fe709f4ea41d278aTripp * @param method {String} the name of the method to exectute.
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * Ex: 'Object.keys'.
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp * @param args {Array} the arguments to apply to the method.
6c4ec9d420df654d019b936fd06bef6f769db4cbTripp * @return {Object} the return value from the applied method or null.
6c4ec9d420df654d019b936fd06bef6f769db4cbTripp this.log(method + ': applyTo not allowed', 'warn', 'yui');
6c4ec9d420df654d019b936fd06bef6f769db4cbTripp return null;
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp this.log('applyTo not found: ' + method, 'warn', 'yui');
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp return null;
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTrippRegisters a module with the YUI global. The easiest way to create a
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTrippfirst-class YUI module is to use the YUI component build tool.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTrippThe build system will produce the `YUI.add` wrapper for you module, along
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTrippwith any configuration info required for the module.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp@param name {String} module name.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp@param fn {Function} entry point into the module that is used to bind module to the YUI instance.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp@param {YUI} fn.Y The YUI instance this module is executed in.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp@param {String} fn.name The name of the module
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp@param version {String} version string.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp@param details {Object} optional config data:
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp@param details.requires {Array} features that must be present before this module can be attached.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp@param details.optional {Array} optional features that should be present if loadOptional
9eaaa502227248d304ac9170902697d02158c1d9Tripp is defined. Note: modules are not often loaded this way in YUI 3,
9eaaa502227248d304ac9170902697d02158c1d9Tripp but this field is still useful to inform the user that certain
9eaaa502227248d304ac9170902697d02158c1d9Tripp features in the component will require additional dependencies.
9eaaa502227248d304ac9170902697d02158c1d9Tripp@param details.use {Array} features that are included within this module which need to
9eaaa502227248d304ac9170902697d02158c1d9Tripp be attached automatically when this module is attached. This
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp supports the YUI 3 rollup system -- a module with submodules
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp defined will need to have the submodules listed in the 'use'
4ef2f7e4cb7c7d255be077c47d542199f7bf8607Tripp config. The YUI component build tool does this for you.
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp@return {YUI} the YUI instance.
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp YUI.add('davglass', function(Y, name) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp Y.davglass = function() {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp alert('Dav was here!');
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp }, '3.4.0', { requires: ['yui-base', 'harley-davidson', 'mt-dew'] });
b57ff76ab2ce5f3017d61855f13ed04ab46a965cTripp for (i in instances) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp if (!loader.moduleInfo[name] || loader.moduleInfo[name].temp) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp return this;
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * Executes the function associated with each required
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * module, binding the module to the YUI instance.
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @param {Array} r The array of modules to attach
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @param {Boolean} [moot=false] Don't throw a warning if the module is not attached
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp * @method _attach
0fdefaa9ca017edfb76b736c825b34186f33045aTripp Y = this, j,
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp //Check for conditional modules (in a second+ instance) and add their requirements
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp //TODO I hate this entire method, it needs to be fixed ASAP (3.5.0) ^davglass
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp Y.Object.each(loader.conditions[name], function(def) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp var go = def && ((def.ua && Y.UA[def.ua]) || (def.test && def.test(Y)));
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp if (!done[r[i]]) {
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp // Y.log('no js def for: ' + name, 'info', 'yui');
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp //if (!loader || !loader.moduleInfo[name]) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp //if ((!loader || !loader.moduleInfo[name]) && !moot) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp if ((name.indexOf('skin-') === -1) && (name.indexOf('css') === -1)) {
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp //Don't like this, but in case a mod was asked for once, then we fetch it
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp //We need to remove it from the missed list ^davglass
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp Y.message('Found: ' + name + ' (was reported as missing earlier)', 'warn', 'yui');
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp return false;
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp return false;
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp } catch (e) {
c7ba96d16d58075a9ab8d5c1e46c6c83ce11cb4eTripp return false;
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp return false;
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp return true;
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * Attaches one or more modules to the YUI instance. When this
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * is executed, the requirements are analyzed, and one of
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * several things can happen:
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * * All requirements are available on the page -- The modules
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * are attached to the instance. If supplied, the use callback
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * is executed synchronously.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * * Modules are missing, the Get utility is not available OR
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * the 'bootstrap' config is false -- A warning is issued about
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * the missing modules and all available modules are attached.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * * Modules are missing, the Loader is not available but the Get
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * utility is and boostrap is not false -- The loader is bootstrapped
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * before doing the following....
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * * Modules are missing and the Loader is available -- The loader
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * expands the dependency tree and fetches missing modules. When
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * the loader is finshed the callback supplied to use is executed
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * asynchronously.
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @method use
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @param modules* {String|Array} 1-n modules to bind (uses arguments array).
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @param [callback] {Function} callback function executed when
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * the instance has the required functionality. If included, it
a89ad754cce3cfc8aee71760e10217b54020360dTripp * must be the last parameter.
a89ad754cce3cfc8aee71760e10217b54020360dTripp * @param callback.Y {YUI} The `YUI` instance created for this sandbox
09688ec5ffb8b9cf9883a770e2f9ebd60b28888dTripp * @param callback.data {Object} Object data returned from `Loader`.
use: function() {
name,
provisioned = true;
callback = null;
provisioned = false;
if (provisioned) {
if (Y._loading) {
* Notify handler from Loader for attachment/load errors
* @param callback {Function} The callback to pass to the `Y.config.loadErrorFn`
} else if (callback) {
YArray = Y.Array,
missing = [],
ret = true,
if (aliases) {
names = a;
if (!skip) {
success: true,
ret = true,
Y._loading = false;
if (data) {
missing = [];
if (redo) {
redo = false;
Y._loading = true;
if (data) {
if (ret) {
if (ret) {
handleLoader();
if (len) {
Y._loading = true;
Y._loading = true;
handleBoot = function() {
Y._loading = false;
if (ret) {
handleLoader();
namespace: function() {
for (; i < a.length; i++) {
arg = a[i];
* @param src Optional additional info (passed to `Y.config.errorFn` and `Y.message`)
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;
fullpath: './davglass.js'
fullpath: './foo.js'
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"
* mycssmod: '/css/mycssmod.css'
* 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.isDate = function(o) {
L.isFunction = function(o) {
L.isNull = function(o) {
L.isNumber = function(o) {
L.isString = function(o) {
L.isUndefined = function(o) {
L.isValue = function(o) {
var t = L.type(o);
return isFinite(o);
return new Date().getTime();
L.sub = function(s, o) {
return s.trimLeft();
return s.trimRight();
L.type = function(o) {
} catch (ex) {
result = [];
return result;
return [thing];
Y.Array = YArray;
var hash = {},
results = [],
return results;
if (i in array) {
var hash = {},
i, len;
if (i in keys) {
return hash;
// http://es5.github.com/#x15.4.4.14
return from;
} catch (ex) {}
return result;
function Queue() {
this._init();
_init: function() {
this._q = [];
next: function() {
last: function() {
add: function() {
size: function() {
return function (arg) {
String(arg);
(e.g. Node.js).
[WebKit Bug 34679](https://bugs.webkit.org/show_bug.cgi?id=34679).
Y.getLocation = function () {
// YUI instance before a user's config is applied; i.e. `Y.config.win` does
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;
} catch (ex) {
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,
accel: false,
secure: false,
os: null,
if (ua) {
o.ios = m;
if (!o.android) {
o.accel = true;
if (!subUA) {
"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"],
"datatable": ["datatable-core","datatable-head","datatable-body","datatable-base","datatable-column-widths","datatable-message","datatable-mutable","datatable-sort","datatable-datasource"],
"datatable-deprecated": ["datatable-base-deprecated","datatable-datasource-deprecated","datatable-sort-deprecated","datatable-scroll-deprecated"],
"dd": ["dd-ddm-base","dd-ddm","dd-ddm-drop","dd-drag","dd-proxy","dd-constrain","dd-drop","dd-scroll","dd-delegate"],
"editor": ["frame","editor-selection","exec-command","editor-base","editor-para","editor-br","editor-bidi","editor-tab","createlink-base"],
"event": ["event-base","event-delegate","event-synthetic","event-mousewheel","event-mouseenter","event-key","event-focus","event-resize","event-hover","event-outside","event-touch","event-move","event-flick","event-valuechange"],
* NodeJS specific Get module used to load remote resources. It contains the same signature as the default Get module so there is no code change needed.
Y.Get = function() {
* Escape the path for Windows, they need to be double encoded when used as `__dirname` or `__filename`
var escapeWinPath = function(p) {
var self = this;
var cfg = {
if (err) {
if (err) {
self = this,
check = function() {
if (!Y.config) {
Y.config = {
* Alias for `Y.Get.js`
Y.Get.script = Y.Get.js;
Y.log('Y.Get.css is not supported, just reporting that it has loaded but not fetching.', 'warn', 'get');
* @param {String} name The number sequence of the test, how it's reported in the URL or config: 1, 2, 3
* @param {Function} o.test The test function to execute, the only argument to the function is the `Y` instance
result = [];
if (cat_o) {
if (!feature) {
if (ua) {
return result;
/* This file is auto-generated by src/loader/scripts/meta_join.py */
svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
ret = true;
return ret;
ret = false;
test: function() {
test: function() {
return ret;
return ret;
svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
var SPLIT_REGEX = /[, ]/;
return availableLanguages[i];
if (result) {
return result;
* console implementations. This module is a `core` YUI module, <a href="../classes/YUI.html#method_log">it's documentation is located under the YUI class</a>.
var INSTANCE = Y,
Y = INSTANCE,
c = Y.config,
if (c.debug) {
if (src) {
if (!bail) {
if (c.useBrowserConsole) {
console[f](m);
hasColor = false;
} catch (ex) {
hasColor = true;
return str;
if (!num) {
if (this.id) {
if (str === null) {
switch (t.toLowerCase()) {
* Provides a setTimeout/setInterval wrapper. This module is a `core` YUI module, <a href="../classes/YUI.html#method_later">it's documentation is located under the YUI class</a>.
var NO_ARGS = [];
var cancelled = false,
wrapper = function() {
if (!cancelled) {
cancel: function() {
cancelled = true;
if (this.interval) {
groups: {},
patterns: {} },
ext: false,
combine: true,
combine: true,
ext: false,
patterns: {
yui2Update();
var NOT_FOUND = {},
NO_REQUIREMENTS = [],
YObject = Y.Object,
YArray = Y.Array,
L = Y.Lang,
if (!nomin) {
return path;
* @param {String} config.comboBase The Combo service base path. Ex: `http://yui.yahooapis.com/combo?`
* @param {String} config.root The root path to prepend to module names for the combo service. Ex: `2.5.2/build/`
* @param {String|Object} config.filter A filter to apply to result urls. <a href="#property_filter">See filter property</a>
* @param {Object} config.filters Per-component filter specification. If specified for a given component, this overrides the filter config.
* @param {Boolean} config.combine Use a combo service to reduce the number of http connections required to load your dependencies
* @param {Array} config.force A list of modules that should always be loaded when required, even if already present on the page
* @param {HTMLElement|String} config.insertBefore Node or id for a node that should be used as the insertion point for new nodes
* @param {Object} config.jsAttributes Object literal containing attributes to add to script nodes
* @param {Number} config.timeout The number of milliseconds before a timeout occurs when dynamically loading nodes. If not set, there is no timeout
* @param {Function} config.onCSS Callback for the 'CSSComplete' event. When loading YUI components with CSS the CSS is loaded first, then the script. This provides a moment you can tie into to improve the presentation of the page while the script is loading.
* @param {Object} config.modules A list of module definitions. See <a href="#method_addModule">Loader.addModule</a> for the supported module metadata
* @param {Object} config.groups A list of group definitions. Each group can contain specific definitions for `base`, `comboBase`, `combine`, and accepts a list of `modules`.
* @param {String} config.2in3 The version of the YUI 2 in 3 wrapper to use. The intrinsic support for YUI 2 modules in YUI 3 relies on versions of the YUI 2 components inside YUI 3 module wrappers. These wrappers change over time to accomodate the issues that arise from running YUI 2 in a YUI 3 sandbox.
* @param {String} config.yui2 When using the 2in3 project, you can select the version of YUI 2 to use. Valid values are `2.2.2`, `2.3.1`, `2.4.1`, `2.5.2`, `2.6.0`, `2.7.0`, `2.8.0`, `2.8.1` and `2.9.0` [default] -- plus all versions of YUI 2 going forward.
Y.Loader = function(o) {
self = this;
// self.jsAttributes = null;
* @default http://yui.yahooapis.com/[YUI VERSION]/build/
* @default 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).
* 'replaceStr': "-debug.js"
if (cache) {
FILTER_DEFS: {
RAW: {
DEBUG: {
_inspectPage: function() {
this.loaded[k] = true;
if (v.details) {
var m = this.moduleInfo[k],
delete m.expanded;
m._inspected = true;
if (!m || !other) {
_config: function(o) {
if (o.hasOwnProperty(i)) {
val = o[i];
val = {
for (j in val) {
groupName = j;
if (L.isString(f)) {
f = f.toUpperCase();
if (mod) {
if (mod) {
nmod = {
Y.log('Adding skin (' + name + '), ' + parent + ', ' + pkg + ', ' + info[name].path, 'info', 'loader');
return name;
* //out.js will contain Node and YQL modules
this.addModule({
self = this;
if (o.patterns) {
if (mods) {
}, self);
* @param {Array} [config.after] Array of modules the components which, if present, should be sorted above this one
* @param {Object} [config.after_map] Faster alternative to 'after' -- supply a hash instead of an array
* @param {String} [config.fullpath] If `fullpath` is specified, this is used instead of the configured `base + path`
* @param {Boolean} [config.skinnable] Flag to determine if skin assets should automatically be pulled in
* @param {String} [config.group] The group the module belongs to -- this is set automatically when it is added as part of a group configuration.
* @param {Array} [config.lang] Array of BCP 47 language tags of languages for which this module has localized resource bundles, e.g., `["en-GB", "zh-Hans-CN"]`
* @param {Object} [config.condition] Specifies that the module should be loaded automatically if a condition is met. This is an object with up to three fields:
* @param {Function} [config.condition.test] A function that returns true when the module is to be loaded.
* @param {Function} [config.configFn] A function to exectute when configuring this module
* @param {Object} config.configFn.mod The module config, modifying this object will modify it's config. Returning false will delete the module's config.
* @return {Object} the module definition or null if the object passed in did not provide all required attributes.
if (!o || !o.name) {
if (!o.type) {
if (o.skinnable) {
if (!smod) {
if (subs) {
for (i in subs) {
s = subs[i];
if (s.supersedes) {
o.skinnable = true;
i, name);
i, name);
if (!smod) {
if (!smod) {
if (this.allowRollup) {
if (plugins) {
for (i in plugins) {
if (o.skinnable) {
if (o.condition) {
trigger = t[i];
if (o.supersedes) {
if (o.after) {
if (o.configFn) {
if (ret === false) {
this.dirty = true;
this._explodeRollups();
* Actually ask for: "dd-ddm-base,dd-ddm,dd-ddm-drop,dd-drag,dd-proxy,dd-constrain,dd-drop,dd-scroll,dd-drop-plugin"
_explodeRollups: function() {
var self = this, m,
if (m && m.use) {
if (m && m.use) {
filterRequires: function(r) {
var c = [], i, mod, o, m;
if (m && m.use) {
c.push(r[i]);
if (!mod) {
return NO_REQUIREMENTS;
d, k, m1,
r, old_mod,
hash;
hash = {};
intl = true;
if (!hash[r[i]]) {
d.push(r[i]);
hash[r[i]] = true;
m = this.getModule(r[i]);
if (!hash[r[i]]) {
d.push(r[i]);
hash[r[i]] = true;
m = this.getModule(r[i]);
if (o && this.loadOptional) {
if (!hash[o[i]]) {
d.push(o[i]);
hash[o[i]] = true;
m = info[o[i]];
if (cond) {
//Set the module to not parsed since we have conditionals and this could change the dependency tree.
if (go) {
skinpar = n;
if (intl) {
if (packName) {
ret = false,
if (!style) {
ret = true;
return ret;
return NOT_FOUND;
if (m && !m.provides) {
s = m.supersedes;
o[name] = true;
m.provides = o;
return m.provides;
this._config(o);
if (!this._init) {
this._setup();
this._explode();
if (this.allowRollup) {
this._rollup();
this._explodeRollups();
this._reduce();
this._sort();
* @param {String} packName The name of the package (e.g: lang/datatype-date-en-US)
if (!existing) {
conf = {
intl: true,
langPack: true,
supersedes: []
if (m.configFn) {
if (lang) {
_setup: function() {
if (!this.ignoreRegistered) {
if (this.ignore) {
if (l.hasOwnProperty(j)) {
if (this.force) {
if (this.force[i] in l) {
delete l[this.force[i]];
this._init = true;
_explode: function() {
self = this;
if (expound) {
if (!mname) {
if (!p.test) {
found = p;
if (found) {
if (p.action) {
m.temp = true;
_rollup: function() { },
_reduce: function(r) {
r = r || this.required;
if (r.hasOwnProperty(i)) {
m = this.getModule(i);
s = m && m.supersedes;
if (onEnd) {
this._continue();
_onSuccess: function() {
if (fn) {
_onProgress: function(e) {
var self = this;
_onFailure: function(o) {
for (i; i < len; i++) {
success: false
_onTimeout: function() {
var f = this.onTimeout;
success: false
_sort: function() {
done = {},
l = s.length;
moved = false;
doneKey = a + s[k];
moved = true;
if (moved) {
if (!moved) {
this.sorted = s;
if (source) {
if (!skipcalc) {
this.calculate(o);
if (type) {
comp++;
comp++;
var complete = function(d) {
actions++;
if (d && d.errors) {
u = d.errors[i];
errs[u] = u;
if (d && d.fn) {
delete d.fn;
this._loading = true;
complete({
onProgress: function(e) {
onTimeout: function(d) {
onSuccess: function(d) {
onFailure: function(d) {
autopurge: false,
async: true,
onProgress: function(e) {
onTimeout: function(d) {
onSuccess: function(d) {
onFailure: function(d) {
_continue: function() {
this._continue();
var f = this.filter,
hasFilter = true;
if (hasFilter) {
* Returns an Object hash of file arrays built from `loader.sorted` or from an arbitrary list of sorted modules.
if (calc) {
var addSingle = function(m) {
url = {
if (m.attributes) {
comboSources = {};
addSingle(m);
m.combine = true;
addSingle(m);
for (j in comboSources) {
url = j;
if (len) {
m = mods[i];
if (mods[i]) {
for (j in resCombos) {
base = j;
Y.log('maxURLLength (' + maxURLLength + ') is lower than the comboBase length (' + base.length + '), resetting to default (' + MAX_URL_LENGTH + ')', 'error', 'loader');
if (len) {
Y.log('Exceeded maxURLLength (' + maxURLLength + ') for ' + type + ', splitting', 'info', 'loader');
m = u.pop();
u.push(m);
if (u.length) {
resCombos = null;
return resolved;
path: 'mod.js'
if (!cb) {
var self = this,
this.rollups = {};
for (i in info) {
m = this.getModule(i);
if (m && m.rollup) {
this.rollups[i] = m;
rolled = false;
for (i in this.rollups) {
m = this.getModule(i);
s = m.supersedes || [];
roll = false;
if (!m.rollup) {
roll = false;
if (roll) {
if (roll) {
rolled = true;
this.getRequires(m);
if (!rolled) {
/* This file is auto-generated by src/loader/scripts/meta_join.py */
ret = false;
test: function() {
test: function() {
return ret;
svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
return ret;
ret = true;
return ret;