2 YUI 3.13.0 (build 508226d)
3 Copyright 2013 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
8 YUI.add('loader-base', function (Y, NAME) {
13 * @submodule loader-base
17 var VERSION = Y.version,
20 CDN_BASE = Y.Env.base,
21 GALLERY_VERSION = 'gallery-2013.10.02-20-26',
24 YUI2_VERSION = '2.9.0',
25 COMBO_BASE = CDN_BASE + 'combo?',
30 comboBase: COMBO_BASE,
33 base: 'assets/skins/',
48 yui2Update = function(tnt, yui2, config) {
49 var root = TNT + '.' +
50 (tnt || TNT_VERSION) + '/' +
51 (yui2 || YUI2_VERSION) + BUILD,
52 base = (config && config.base) ? config.base : CDN_BASE,
53 combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE;
55 groups.yui2.base = base + root;
56 groups.yui2.root = root;
57 groups.yui2.comboBase = combo;
59 galleryUpdate = function(tag, config) {
60 var root = (tag || GALLERY_VERSION) + BUILD,
61 base = (config && config.base) ? config.base : CDN_BASE,
62 combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE;
64 groups.gallery.base = base + root;
65 groups.gallery.root = root;
66 groups.gallery.comboBase = combo;
75 comboBase: COMBO_BASE,
76 update: galleryUpdate,
89 comboBase: COMBO_BASE,
93 configFn: function(me) {
94 if (/-skin|reset|fonts|grids|base/.test(me.name)) {
96 me.path = me.path.replace(/\.js/, '.css');
97 // this makes skins in builds earlier than
98 // 2.6.0 work as long as combine is false
99 me.path = me.path.replace(/\/yui2-skin/,
100 '/assets/skins/sam/yui2-skin');
110 if (YUI.Env[VERSION]) {
111 Y.mix(META, YUI.Env[VERSION], false, [
118 YUI.Env[VERSION] = META;
120 /*jslint forin: true, maxlen: 350 */
123 * Loader dynamically loads script and css files. It includes the dependency
124 * information for the version of the library in use, and will automatically pull in
125 * dependencies for the modules requested. It can also load the
126 * files from the Yahoo! CDN, and it can utilize the combo service provided on
127 * this network to reduce the number of http connections required to download
132 * @submodule loader-base
136 NO_REQUIREMENTS = [],
137 MAX_URL_LENGTH = 1024,
138 GLOBAL_ENV = YUI.Env,
139 GLOBAL_LOADED = GLOBAL_ENV._loaded,
143 DEFAULT_SKIN = 'sam',
147 oeach = YObject.each,
149 _queue = GLOBAL_ENV._loaderQueue,
150 META = GLOBAL_ENV[VERSION],
151 SKIN_PREFIX = 'skin-',
153 ON_PAGE = GLOBAL_ENV.mods,
155 _path = function(dir, file, type, nomin) {
156 var path = dir + '/' + file;
160 path += '.' + (type || CSS);
166 if (!YUI.Env._cssLoaded) {
167 YUI.Env._cssLoaded = {};
172 * The component metadata is stored in Y.Env.meta.
173 * Part of the loader module.
180 * Loader dynamically loads script and css files. It includes the dependency
181 * info for the version of the library in use, and will automatically pull in
182 * dependencies for the modules requested. It can load the
183 * files from the Yahoo! CDN, and it can utilize the combo service provided on
184 * this network to reduce the number of http connections required to download
185 * YUI files. You can also specify an external, custom combo service to host
186 * your modules as well.
189 var loader = new Y.Loader({
194 require: ['node', 'dd', 'console']
196 var out = loader.resolve(true);
200 * @param {Object} config an optional set of configuration options.
201 * @param {String} config.base The base dir which to fetch this module from
202 * @param {String} config.comboBase The Combo service base path. Ex: `http://yui.yahooapis.com/combo?`
203 * @param {String} config.root The root path to prepend to module names for the combo service. Ex: `2.5.2/build/`
204 * @param {String|Object} config.filter A filter to apply to result urls. <a href="#property_filter">See filter property</a>
205 * @param {Object} config.filters Per-component filter specification. If specified for a given component, this overrides the filter config.
206 * @param {Boolean} config.combine Use a combo service to reduce the number of http connections required to load your dependencies
207 * @param {Boolean} [config.async=true] Fetch files in async
208 * @param {Array} config.ignore: A list of modules that should never be dynamically loaded
209 * @param {Array} config.force A list of modules that should always be loaded when required, even if already present on the page
210 * @param {HTMLElement|String} config.insertBefore Node or id for a node that should be used as the insertion point for new nodes
211 * @param {Object} config.jsAttributes Object literal containing attributes to add to script nodes
212 * @param {Object} config.cssAttributes Object literal containing attributes to add to link nodes
213 * @param {Number} config.timeout The number of milliseconds before a timeout occurs when dynamically loading nodes. If not set, there is no timeout
214 * @param {Object} config.context Execution context for all callbacks
215 * @param {Function} config.onSuccess Callback for the 'success' event
216 * @param {Function} config.onFailure Callback for the 'failure' event
217 * @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.
218 * @param {Function} config.onTimeout Callback for the 'timeout' event
219 * @param {Function} config.onProgress Callback executed each time a script or css file is loaded
220 * @param {Object} config.modules A list of module definitions. See <a href="#method_addModule">Loader.addModule</a> for the supported module metadata
221 * @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`.
222 * @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.
223 * @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.
225 Y.Loader = function(o) {
229 //Catch no config passed.
232 modulekey = META.md5;
235 * Internal callback to handle multiple internal insert() calls
236 * so that css is inserted prior to js
237 * @property _internalCallback
240 // self._internalCallback = null;
243 * Callback that will be executed when the loader is finished
248 // self.onSuccess = null;
251 * Callback that will be executed if there is a failure
255 // self.onFailure = null;
258 * Callback for the 'CSSComplete' event. When loading YUI components
259 * with CSS the CSS is loaded first, then the script. This provides
260 * a moment you can tie into to improve the presentation of the page
261 * while the script is loading.
265 // self.onCSS = null;
268 * Callback executed each time a script or css file is loaded
272 // self.onProgress = null;
275 * Callback that will be executed if a timeout occurs
279 // self.onTimeout = null;
282 * The execution context for all callbacks
284 * @default {YUI} the YUI instance
289 * Data that is passed to all callbacks
295 * Node reference or id where new nodes should be inserted before
296 * @property insertBefore
297 * @type string|HTMLElement
299 // self.insertBefore = null;
302 * The charset attribute for inserted nodes
305 * @deprecated , use cssAttributes or jsAttributes.
307 // self.charset = null;
310 * An object literal containing attributes to add to link nodes
311 * @property cssAttributes
314 // self.cssAttributes = null;
317 * An object literal containing attributes to add to script nodes
318 * @property jsAttributes
321 // self.jsAttributes = null;
324 * The base directory.
327 * @default http://yui.yahooapis.com/[YUI VERSION]/build/
329 self.base = Y.Env.meta.base + Y.Env.meta.root;
332 * Base path for the combo service
333 * @property comboBase
335 * @default http://yui.yahooapis.com/combo?
337 self.comboBase = Y.Env.meta.comboBase;
340 * Base path for language packs.
342 // self.langBase = Y.Env.meta.langBase;
346 * If configured, the loader will attempt to use the combo
347 * service for YUI resources and configured external resources.
350 * @default true if a base dir isn't in the config
352 self.combine = o.base &&
353 (o.base.indexOf(self.comboBase.substr(0, 20)) > -1);
356 * The default seperator to use between files in a combo URL
363 * Max url length for combo urls. The default is 1024. This is the URL
364 * limit for the Yahoo! hosted combo servers. If consuming
365 * a different combo service that has a different URL limit
366 * it is possible to override this default by supplying
367 * the maxURLLength config option. The config option will
368 * only take effect if lower than the default.
370 * @property maxURLLength
373 self.maxURLLength = MAX_URL_LENGTH;
376 * Ignore modules registered on the YUI global
377 * @property ignoreRegistered
380 self.ignoreRegistered = o.ignoreRegistered;
383 * Root path to prepend to module path for the combo
387 * @default [YUI VERSION]/build/
389 self.root = Y.Env.meta.root;
392 * Timeout value in milliseconds. If set, self value will be used by
393 * the get utility. the timeout event will fire if
401 * A list of modules that should not be loaded, even if
402 * they turn up in the dependency tree
406 // self.ignore = null;
409 * A list of modules that should always be loaded, even
410 * if they have already been inserted into the page.
414 // self.force = null;
419 * Should we allow rollups
420 * @property allowRollup
424 self.allowRollup = false;
427 * A filter to apply to result urls. This filter will modify the default
428 * path for all modules. The default path for the YUI library is the
429 * minified version of the files (e.g., event-min.js). The filter property
430 * can be a predefined filter or a custom filter. The valid predefined
434 * <dd>Selects the debug versions of the library (e.g., event-debug.js).
435 * This option will automatically include the Logger widget</dd>
437 * <dd>Selects the non-minified version of the library (e.g., event.js).
440 * You can also define a custom filter, which must be an object literal
441 * containing a search expression and a replace string:
444 * 'searchExp': "-min\\.js",
445 * 'replaceStr': "-debug.js"
449 * @type string| {searchExp: string, replaceStr: string}
451 // self.filter = null;
454 * per-component filter specification. If specified for a given
455 * component, this overrides the filter config.
462 * The list of requested modules
464 * @type {string: boolean}
469 * If a module name is predefined when requested, it is checked againsts
470 * the patterns provided in this property. If there is a match, the
471 * module is added with the default configuration.
473 * At the moment only supporting module prefixes, but anticipate
474 * supporting at least regular expressions.
478 // self.patterns = Y.merge(Y.Env.meta.patterns);
482 * The library metadata
483 * @property moduleInfo
485 // self.moduleInfo = Y.merge(Y.Env.meta.moduleInfo);
486 self.moduleInfo = {};
488 self.groups = Y.merge(Y.Env.meta.groups);
491 * Provides the information used to skin the skinnable components.
492 * The following skin definition would result in 'skin1' and 'skin2'
493 * being loaded for calendar (if calendar was requested), and
494 * 'sam' for all other skinnable components:
497 * // The default skin, which is automatically applied if not
498 * // overriden by a component-specific skin definition.
499 * // Change this in to apply a different skin globally
500 * defaultSkin: 'sam',
502 * // This is combined with the loader base property to get
503 * // the default root directory for a skin. ex:
504 * // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/
505 * base: 'assets/skins/',
507 * // Any component-specific overrides can be specified here,
508 * // making it possible to load different skins for different
509 * // components. It is possible to load more than one skin
510 * // for a given component as well.
512 * calendar: ['skin1', 'skin2']
518 self.skin = Y.merge(Y.Env.meta.skin);
521 * Map of conditional modules
524 self.conditions = {};
526 // map of modules with a hash of modules that meet the requirement
527 // self.provides = {};
530 self._internal = true;
532 self._populateCache();
535 * Set when beginning to compute the dependency tree.
536 * Composed of what YUI reports to be loaded combined
537 * with what has been loaded by any instance on the page
538 * with the version number specified in the metadata.
540 * @type {string: boolean}
542 self.loaded = GLOBAL_LOADED[VERSION];
546 * Should Loader fetch scripts in `async`, defaults to `true`
554 self._internal = false;
558 self.forceMap = (self.force) ? Y.Array.hash(self.force) : {};
560 self.testresults = null;
562 if (Y.config.tests) {
563 self.testresults = Y.config.tests;
567 * List of rollup files found in the library metadata
570 // self.rollups = null;
573 * Whether or not to load optional dependencies for
574 * the requested modules
575 * @property loadOptional
579 // self.loadOptional = false;
582 * All of the derived dependencies in sorted order, which
583 * will be populated when either calculate() or insert()
591 * A list of modules to attach to the YUI instance when complete.
592 * If not supplied, the sorted list of dependencies are applied.
593 * @property attaching
595 // self.attaching = null;
598 * Flag to indicate the dependency tree needs to be recomputed
599 * if insert is called again.
607 * List of modules inserted by the utility
609 * @type {string: boolean}
614 * List of skipped modules during insert() because the module
620 // Y.on('yui:load', self.loadNext, self);
625 * Cached sorted calculate results
631 if (self.ignoreRegistered) {
632 //Clear inpage already processed modules.
633 self._resetModules();
638 Y.Loader.prototype = {
640 * Checks the cache for modules and conditions, if they do not exist
641 * process the default metadata and populate the local moduleInfo hash.
642 * @method _populateCache
645 _populateCache: function() {
647 defaults = META.modules,
648 cache = GLOBAL_ENV._renderedMods,
651 if (cache && !self.ignoreRegistered) {
653 if (cache.hasOwnProperty(i)) {
654 self.moduleInfo[i] = Y.merge(cache[i]);
658 cache = GLOBAL_ENV._conditions;
660 if (cache.hasOwnProperty(i)) {
661 self.conditions[i] = Y.merge(cache[i]);
666 for (i in defaults) {
667 if (defaults.hasOwnProperty(i)) {
668 self.addModule(defaults[i], i);
675 * Reset modules in the module cache to a pre-processed state so additional
676 * computations with a different skin or language will work as expected.
677 * @method _resetModules
680 _resetModules: function() {
681 var self = this, i, o,
683 for (i in self.moduleInfo) {
684 if (self.moduleInfo.hasOwnProperty(i)) {
685 mod = self.moduleInfo[i];
687 details = (YUI.Env.mods[name] ? YUI.Env.mods[name].details : null);
690 self.moduleInfo[name]._reset = true;
691 self.moduleInfo[name].requires = details.requires || [];
692 self.moduleInfo[name].optional = details.optional || [];
693 self.moduleInfo[name].supersedes = details.supercedes || [];
697 for (o in mod.defaults) {
698 if (mod.defaults.hasOwnProperty(o)) {
700 mod[o] = mod.defaults[o];
705 delete mod.langCache;
706 delete mod.skinCache;
708 self._addSkin(self.skin.defaultSkin, mod.name);
714 Regex that matches a CSS URL. Used to guess the file type when it's not
723 REGEX_CSS: /\.css(?:[?;].*)?$/i,
726 * Default filters for raw and debug
727 * @property FILTER_DEFS
734 'searchExp': '-min\\.js',
738 'searchExp': '-min\\.js',
739 'replaceStr': '-debug.js'
742 'searchExp': '-min\\.js',
743 'replaceStr': '-coverage.js'
747 * Check the pages meta-data and cache the result.
748 * @method _inspectPage
751 _inspectPage: function() {
752 var self = this, v, m, req, mr, i;
754 //Inspect the page for CSS only modules and mark them as loaded.
755 for (i in self.moduleInfo) {
756 if (self.moduleInfo.hasOwnProperty(i)) {
757 v = self.moduleInfo[i];
758 if (v.type && v.type === CSS) {
759 if (self.isCSSLoaded(v.name)) {
760 Y.log('Found CSS module on page: ' + v.name, 'info', 'loader');
761 self.loaded[i] = true;
767 if (ON_PAGE.hasOwnProperty(i)) {
770 m = self.moduleInfo[v.name];
771 req = v.details.requires;
772 mr = m && m.requires;
775 if (!m._inspected && req && mr.length !== req.length) {
776 // console.log('deleting ' + m.name);
780 m = self.addModule(v.details, i);
788 * returns true if b is not loaded, and is required directly or by means of modules it supersedes.
791 * @param {String} mod1 The first module to compare
792 * @param {String} mod2 The second module to compare
794 _requires: function(mod1, mod2) {
796 var i, rm, after_map, s,
797 info = this.moduleInfo,
806 after_map = m.after_map;
808 // check if this module should be sorted after the other
809 // do this first to short circut circular deps
810 if (after_map && (mod2 in after_map)) {
814 after_map = other.after_map;
817 if (after_map && (mod1 in after_map)) {
821 // check if this module requires one the other supersedes
822 s = info[mod2] && info[mod2].supersedes;
824 for (i = 0; i < s.length; i++) {
825 if (this._requires(mod1, s[i])) {
831 s = info[mod1] && info[mod1].supersedes;
833 for (i = 0; i < s.length; i++) {
834 if (this._requires(mod2, s[i])) {
840 // check if this module requires the other directly
841 // if (r && yArray.indexOf(r, mod2) > -1) {
842 if (rm && (mod2 in rm)) {
846 // external css files should be sorted below yui css
847 if (m.ext && m.type === CSS && !other.ext && other.type === CSS) {
854 * Apply a new config to the Loader instance
857 * @param {Object} o The new configuration
859 _config: function(o) {
860 var i, j, val, a, f, group, groupName, self = this,
862 // apply config values
865 if (o.hasOwnProperty(i)) {
867 //TODO This should be a case
868 if (i === 'require') {
870 } else if (i === 'skin') {
871 //If the config.skin is a string, format to the expected object
872 if (typeof val === 'string') {
873 self.skin.defaultSkin = o.skin;
879 Y.mix(self.skin, val, true);
880 } else if (i === 'groups') {
882 if (val.hasOwnProperty(j)) {
883 // Y.log('group: ' + j);
886 self.addGroup(group, groupName);
888 for (a in group.aliases) {
889 if (group.aliases.hasOwnProperty(a)) {
890 self.addAlias(group.aliases[a], a);
897 } else if (i === 'modules') {
898 // add a hash of module definitions
900 if (val.hasOwnProperty(j)) {
901 self.addModule(val[j], j);
904 } else if (i === 'aliases') {
906 if (val.hasOwnProperty(j)) {
907 self.addAlias(val[j], j);
910 } else if (i === 'gallery') {
911 if (this.groups.gallery.update) {
912 this.groups.gallery.update(val, o);
914 } else if (i === 'yui2' || i === '2in3') {
915 if (this.groups.yui2.update) {
916 this.groups.yui2.update(o['2in3'], o.yui2, o);
931 self.filter = self.FILTER_DEFS[f];
933 self.require('yui-log', 'dump');
937 if (self.filterName && self.coverage) {
938 if (self.filterName === 'COVERAGE' && L.isArray(self.coverage) && self.coverage.length) {
939 for (i = 0; i < self.coverage.length; i++) {
940 mod = self.coverage[i];
941 if (self.moduleInfo[mod] && self.moduleInfo[mod].use) {
942 mods = [].concat(mods, self.moduleInfo[mod].use);
947 self.filters = self.filters || {};
948 Y.Array.each(mods, function(mod) {
949 self.filters[mod] = self.FILTER_DEFS.COVERAGE;
951 self.filterName = 'RAW';
952 self.filter = self.FILTER_DEFS[self.filterName];
959 * Returns the skin module name for the specified skin name. If a
960 * module name is supplied, the returned skin module name is
961 * specific to the module passed in.
963 * @param {string} skin the name of the skin.
964 * @param {string} mod optional: the name of a module to skin.
965 * @return {string} the full skin module name.
967 formatSkin: function(skin, mod) {
968 var s = SKIN_PREFIX + skin;
977 * Adds the skin def to the module info
979 * @param {string} skin the name of the skin.
980 * @param {string} mod the name of the module.
981 * @param {string} parent parent module if this is a skin of a
982 * submodule or plugin.
983 * @return {string} the module name for the skin.
986 _addSkin: function(skin, mod, parent) {
987 var mdef, pkg, name, nmod,
988 info = this.moduleInfo,
990 ext = info[mod] && info[mod].ext;
992 // Add a module definition for the module-specific skin css
994 name = this.formatSkin(skin, mod);
997 pkg = mdef.pkg || mod;
1004 path: (parent || pkg) + '/' + sinf.base + skin +
1009 nmod.base = mdef.base;
1011 if (mdef.configFn) {
1012 nmod.configFn = mdef.configFn;
1014 this.addModule(nmod, name);
1016 Y.log('Adding skin (' + name + '), ' + parent + ', ' + pkg + ', ' + info[name].path, 'info', 'loader');
1023 * Adds an alias module to the system
1025 * @param {Array} use An array of modules that makes up this alias
1026 * @param {String} name The name of the alias
1028 * var loader = new Y.Loader({});
1029 * loader.addAlias([ 'node', 'yql' ], 'davglass');
1030 * loader.require(['davglass']);
1031 * var out = loader.resolve(true);
1033 * //out.js will contain Node and YQL modules
1035 addAlias: function(use, name) {
1036 YUI.Env.aliases[name] = use;
1043 * Add a new module group
1045 * @param {Object} config An object containing the group configuration data
1046 * @param {String} config.name required, the group name
1047 * @param {String} config.base The base directory for this module group
1048 * @param {String} config.root The root path to add to each combo resource path
1049 * @param {Boolean} config.combine Should the request be combined
1050 * @param {String} config.comboBase Combo service base path
1051 * @param {Object} config.modules The group of modules
1052 * @param {String} name the group name.
1054 * var loader = new Y.Loader({});
1058 * comboBase: '/combo?',
1061 * //Module List here
1065 addGroup: function(o, name) {
1066 var mods = o.modules,
1069 name = name || o.name;
1071 self.groups[name] = o;
1074 for (i in o.patterns) {
1075 if (o.patterns.hasOwnProperty(i)) {
1076 o.patterns[i].group = name;
1077 self.patterns[i] = o.patterns[i];
1084 if (mods.hasOwnProperty(i)) {
1086 if (typeof v === 'string') {
1087 v = { name: i, fullpath: v };
1090 self.addModule(v, i);
1097 * Add a new module to the component metadata.
1099 * @param {Object} config An object containing the module data.
1100 * @param {String} config.name Required, the component name
1101 * @param {String} config.type Required, the component type (js or css)
1102 * @param {String} config.path Required, the path to the script from `base`
1103 * @param {Array} config.requires Array of modules required by this component
1104 * @param {Array} [config.optional] Array of optional modules for this component
1105 * @param {Array} [config.supersedes] Array of the modules this component replaces
1106 * @param {Array} [config.after] Array of modules the components which, if present, should be sorted above this one
1107 * @param {Object} [config.after_map] Faster alternative to 'after' -- supply a hash instead of an array
1108 * @param {Number} [config.rollup] The number of superseded modules required for automatic rollup
1109 * @param {String} [config.fullpath] If `fullpath` is specified, this is used instead of the configured `base + path`
1110 * @param {Boolean} [config.skinnable] Flag to determine if skin assets should automatically be pulled in
1111 * @param {Object} [config.submodules] Hash of submodules
1112 * @param {String} [config.group] The group the module belongs to -- this is set automatically when it is added as part of a group configuration.
1113 * @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"]`
1114 * @param {Object} [config.condition] Specifies that the module should be loaded automatically if a condition is met. This is an object with up to four fields:
1115 * @param {String} [config.condition.trigger] The name of a module that can trigger the auto-load
1116 * @param {Function} [config.condition.test] A function that returns true when the module is to be loaded.
1117 * @param {String} [config.condition.ua] The UA name of <a href="UA.html">Y.UA</a> object that returns true when the module is to be loaded. e.g., `"ie"`, `"nodejs"`.
1118 * @param {String} [config.condition.when] Specifies the load order of the conditional module
1119 * with regard to the position of the trigger module.
1120 * This should be one of three values: `before`, `after`, or `instead`. The default is `after`.
1121 * @param {Object} [config.testresults] A hash of test results from `Y.Features.all()`
1122 * @param {Function} [config.configFn] A function to exectute when configuring this module
1123 * @param {Object} config.configFn.mod The module config, modifying this object will modify it's config. Returning false will delete the module's config.
1124 * @param {String} [name] The module name, required if not in the module data.
1125 * @return {Object} the module definition or null if the object passed in did not provide all required attributes.
1127 addModule: function(o, name) {
1128 name = name || o.name;
1130 if (typeof o === 'string') {
1131 o = { name: name, fullpath: o };
1135 var subs, i, l, t, sup, s, smod, plugins, plug,
1136 j, langs, packName, supName, flatSup, flatLang, lang, ret,
1137 overrides, skinname, when, g, p,
1138 conditions = this.conditions, trigger;
1140 //Only merge this data if the temp flag is set
1141 //from an earlier pass from a pattern or else
1142 //an override module (YUI_config) can not be used to
1143 //replace a default module.
1144 if (this.moduleInfo[name] && this.moduleInfo[name].temp) {
1145 //This catches temp modules loaded via a pattern
1146 // The module will be added twice, once from the pattern and
1147 // Once from the actual add call, this ensures that properties
1148 // that were added to the module the first time around (group: gallery)
1149 // are also added the second time around too.
1150 o = Y.merge(this.moduleInfo[name], o);
1155 if (!o || !o.name) {
1160 //Always assume it's javascript unless the CSS pattern is matched.
1162 p = o.path || o.fullpath;
1163 if (p && this.REGEX_CSS.test(p)) {
1164 Y.log('Auto determined module type as CSS', 'warn', 'loader');
1169 if (!o.path && !o.fullpath) {
1170 o.path = _path(name, name, o.type);
1172 o.supersedes = o.supersedes || o.use;
1174 o.ext = ('ext' in o) ? o.ext : (this._internal) ? false : true;
1176 // Handle submodule logic
1177 subs = o.submodules;
1179 this.moduleInfo[name] = o;
1181 o.requires = o.requires || [];
1184 Only allowing the cascade of requires information, since
1185 optional and supersedes are far more fine grained than
1186 a blanket requires is.
1188 if (this.requires) {
1189 for (i = 0; i < this.requires.length; i++) {
1190 o.requires.push(this.requires[i]);
1193 if (o.group && this.groups && this.groups[o.group]) {
1194 g = this.groups[o.group];
1196 for (i = 0; i < g.requires.length; i++) {
1197 o.requires.push(g.requires[i]);
1205 requires: o.requires ? [].concat(o.requires) : null,
1206 supersedes: o.supersedes ? [].concat(o.supersedes) : null,
1207 optional: o.optional ? [].concat(o.optional) : null
1211 if (o.skinnable && o.ext && o.temp) {
1212 skinname = this._addSkin(this.skin.defaultSkin, name);
1213 o.requires.unshift(skinname);
1216 if (o.requires.length) {
1217 o.requires = this.filterRequires(o.requires) || [];
1220 if (!o.langPack && o.lang) {
1221 langs = yArray(o.lang);
1222 for (j = 0; j < langs.length; j++) {
1224 packName = this.getLangPackName(lang, name);
1225 smod = this.moduleInfo[packName];
1227 smod = this._addLangPack(lang, o, packName);
1234 sup = o.supersedes || [];
1238 if (subs.hasOwnProperty(i)) {
1241 s.path = s.path || _path(name, i, o.type);
1246 sup = sup.concat(s.supersedes);
1249 smod = this.addModule(s, i);
1252 if (smod.skinnable) {
1254 overrides = this.skin.overrides;
1255 if (overrides && overrides[i]) {
1256 for (j = 0; j < overrides[i].length; j++) {
1257 skinname = this._addSkin(overrides[i][j],
1262 skinname = this._addSkin(this.skin.defaultSkin,
1267 // looks like we are expected to work out the metadata
1268 // for the parent module language packs from what is
1269 // specified in the child modules.
1270 if (s.lang && s.lang.length) {
1272 langs = yArray(s.lang);
1273 for (j = 0; j < langs.length; j++) {
1275 packName = this.getLangPackName(lang, name);
1276 supName = this.getLangPackName(lang, i);
1277 smod = this.moduleInfo[packName];
1280 smod = this._addLangPack(lang, o, packName);
1283 flatSup = flatSup || yArray.hash(smod.supersedes);
1285 if (!(supName in flatSup)) {
1286 smod.supersedes.push(supName);
1289 o.lang = o.lang || [];
1291 flatLang = flatLang || yArray.hash(o.lang);
1293 if (!(lang in flatLang)) {
1297 // Y.log('pack ' + packName + ' should supersede ' + supName);
1298 // Add rollup file, need to add to supersedes list too
1301 packName = this.getLangPackName(ROOT_LANG, name);
1302 supName = this.getLangPackName(ROOT_LANG, i);
1304 smod = this.moduleInfo[packName];
1307 smod = this._addLangPack(lang, o, packName);
1310 if (!(supName in flatSup)) {
1311 smod.supersedes.push(supName);
1314 // Y.log('pack ' + packName + ' should supersede ' + supName);
1315 // Add rollup file, need to add to supersedes list too
1323 //o.supersedes = YObject.keys(yArray.hash(sup));
1324 o.supersedes = yArray.dedupe(sup);
1325 if (this.allowRollup) {
1326 o.rollup = (l < 4) ? l : Math.min(l - 1, 4);
1330 plugins = o.plugins;
1332 for (i in plugins) {
1333 if (plugins.hasOwnProperty(i)) {
1336 plug.path = plug.path || _path(name, i, o.type);
1337 plug.requires = plug.requires || [];
1338 plug.group = o.group;
1339 this.addModule(plug, i);
1341 this._addSkin(this.skin.defaultSkin, i, name);
1349 t = o.condition.trigger;
1350 if (YUI.Env.aliases[t]) {
1351 t = YUI.Env.aliases[t];
1353 if (!Y.Lang.isArray(t)) {
1357 for (i = 0; i < t.length; i++) {
1359 when = o.condition.when;
1360 conditions[trigger] = conditions[trigger] || {};
1361 conditions[trigger][name] = o.condition;
1362 // the 'when' attribute can be 'before', 'after', or 'instead'
1363 // the default is after.
1364 if (when && when !== 'after') {
1365 if (when === 'instead') { // replace the trigger
1366 o.supersedes = o.supersedes || [];
1367 o.supersedes.push(trigger);
1369 // before the trigger
1370 // the trigger requires the conditional mod,
1371 // so it should appear before the conditional
1372 // mod if we do not intersede.
1373 } else { // after the trigger
1374 o.after = o.after || [];
1375 o.after.push(trigger);
1381 o.supersedes = this.filterRequires(o.supersedes);
1385 o.after = this.filterRequires(o.after);
1386 o.after_map = yArray.hash(o.after);
1389 // this.dirty = true;
1392 ret = o.configFn(o);
1393 if (ret === false) {
1394 Y.log('Config function returned false for ' + name + ', skipping.', 'info', 'loader');
1395 delete this.moduleInfo[name];
1396 delete GLOBAL_ENV._renderedMods[name];
1400 //Add to global cache
1402 if (!GLOBAL_ENV._renderedMods) {
1403 GLOBAL_ENV._renderedMods = {};
1405 GLOBAL_ENV._renderedMods[name] = Y.mix(GLOBAL_ENV._renderedMods[name] || {}, o);
1406 GLOBAL_ENV._conditions = conditions;
1413 * Add a requirement for one or more module
1415 * @param {string[] | string*} what the modules to load.
1417 require: function(what) {
1418 var a = (typeof what === 'string') ? yArray(arguments) : what;
1420 this.required = Y.merge(this.required, yArray.hash(this.filterRequires(a)));
1422 this._explodeRollups();
1425 * Grab all the items that were asked for, check to see if the Loader
1426 * meta-data contains a "use" array. If it doesm remove the asked item and replace it with
1427 * the content of the "use".
1428 * This will make asking for: "dd"
1429 * Actually ask for: "dd-ddm-base,dd-ddm,dd-ddm-drop,dd-drag,dd-proxy,dd-constrain,dd-drop,dd-scroll,dd-drop-plugin"
1431 * @method _explodeRollups
1433 _explodeRollups: function() {
1434 var self = this, m, m2, i, a, v, len, len2,
1437 if (!self.allowRollup) {
1439 if (r.hasOwnProperty(i)) {
1440 m = self.getModule(i);
1443 for (a = 0; a < len; a++) {
1444 m2 = self.getModule(m.use[a]);
1446 len2 = m2.use.length;
1447 for (v = 0; v < len2; v++) {
1448 r[m2.use[v]] = true;
1462 * Explodes the required array to remove aliases and replace them with real modules
1463 * @method filterRequires
1464 * @param {Array} r The original requires array
1465 * @return {Array} The new array of exploded requirements
1467 filterRequires: function(r) {
1469 if (!Y.Lang.isArray(r)) {
1473 var c = [], i, mod, o, m;
1475 for (i = 0; i < r.length; i++) {
1476 mod = this.getModule(r[i]);
1477 if (mod && mod.use) {
1478 for (o = 0; o < mod.use.length; o++) {
1479 //Must walk the other modules in case a module is a rollup of rollups (datatype)
1480 m = this.getModule(mod.use[o]);
1481 if (m && m.use && (m.name !== mod.name)) {
1482 c = Y.Array.dedupe([].concat(c, this.filterRequires(m.use)));
1496 * Returns an object containing properties for all modules required
1497 * in order to load the requested module
1498 * @method getRequires
1499 * @param {object} mod The module definition from moduleInfo.
1500 * @return {array} the expanded requirement list.
1502 getRequires: function(mod) {
1505 //console.log('returning no reqs for ' + mod.name);
1506 return NO_REQUIREMENTS;
1510 //console.log('returning requires for ' + mod.name, mod.requires);
1511 return mod.expanded || NO_REQUIREMENTS;
1514 //TODO add modue cache here out of scope..
1516 var i, m, j, add, packName, lang, testresults = this.testresults,
1517 name = mod.name, cond,
1518 adddef = ON_PAGE[name] && ON_PAGE[name].details,
1521 o, skinmod, skindef, skinpar, skinname,
1522 intl = mod.lang || mod.intl,
1523 info = this.moduleInfo,
1524 ftests = Y.Features && Y.Features.tests.load,
1527 // console.log(name);
1529 // pattern match leaves module stub that needs to be filled out
1530 if (mod.temp && adddef) {
1532 mod = this.addModule(adddef, name);
1533 mod.group = old_mod.group;
1534 mod.pkg = old_mod.pkg;
1535 delete mod.expanded;
1538 // console.log('cache: ' + mod.langCache + ' == ' + this.lang);
1540 //If a skin or a lang is different, reparse..
1541 reparse = !((!this.lang || mod.langCache === this.lang) && (mod.skinCache === this.skin.defaultSkin));
1543 if (mod.expanded && !reparse) {
1544 //Y.log('Already expanded ' + name + ', ' + mod.expanded);
1545 return mod.expanded;
1551 r = this.filterRequires(mod.requires);
1553 //If a module has a lang attribute, auto add the intl requirement.
1558 o = this.filterRequires(mod.optional);
1560 // Y.log("getRequires: " + name + " (dirty:" + this.dirty +
1561 // ", expanded:" + mod.expanded + ")");
1564 mod.langCache = this.lang;
1565 mod.skinCache = this.skin.defaultSkin;
1567 for (i = 0; i < r.length; i++) {
1568 //Y.log(name + ' requiring ' + r[i], 'info', 'loader');
1572 m = this.getModule(r[i]);
1574 add = this.getRequires(m);
1575 intl = intl || (m.expanded_map &&
1576 (INTL in m.expanded_map));
1577 for (j = 0; j < add.length; j++) {
1584 // get the requirements from superseded modules, if any
1585 r = this.filterRequires(mod.supersedes);
1587 for (i = 0; i < r.length; i++) {
1589 // if this module has submodules, the requirements list is
1590 // expanded to include the submodules. This is so we can
1591 // prevent dups when a submodule is already loaded and the
1592 // parent is requested.
1593 if (mod.submodules) {
1598 m = this.getModule(r[i]);
1601 add = this.getRequires(m);
1602 intl = intl || (m.expanded_map &&
1603 (INTL in m.expanded_map));
1604 for (j = 0; j < add.length; j++) {
1612 if (o && this.loadOptional) {
1613 for (i = 0; i < o.length; i++) {
1619 add = this.getRequires(m);
1620 intl = intl || (m.expanded_map &&
1621 (INTL in m.expanded_map));
1622 for (j = 0; j < add.length; j++) {
1630 cond = this.conditions[name];
1633 //Set the module to not parsed since we have conditionals and this could change the dependency tree.
1634 mod._parsed = false;
1635 if (testresults && ftests) {
1636 oeach(testresults, function(result, id) {
1637 var condmod = ftests[id].name;
1638 if (!hash[condmod] && ftests[id].trigger === name) {
1639 if (result && ftests[id]) {
1640 hash[condmod] = true;
1647 if (cond.hasOwnProperty(i)) {
1650 //first see if they've specfied a ua check
1651 //then see if they've got a test fn & if it returns true
1652 //otherwise just having a condition block is enough
1653 go = def && ((!def.ua && !def.test) || (def.ua && Y.UA[def.ua]) ||
1654 (def.test && def.test(Y, r)));
1659 m = this.getModule(i);
1661 add = this.getRequires(m);
1662 for (j = 0; j < add.length; j++) {
1674 // Create skin modules
1675 if (mod.skinnable) {
1676 skindef = this.skin.overrides;
1677 for (i in YUI.Env.aliases) {
1678 if (YUI.Env.aliases.hasOwnProperty(i)) {
1679 if (Y.Array.indexOf(YUI.Env.aliases[i], name) > -1) {
1684 if (skindef && (skindef[name] || (skinpar && skindef[skinpar]))) {
1686 if (skindef[skinpar]) {
1689 for (i = 0; i < skindef[skinname].length; i++) {
1690 skinmod = this._addSkin(skindef[skinname][i], name);
1691 if (!this.isCSSLoaded(skinmod, this._boot)) {
1696 skinmod = this._addSkin(this.skin.defaultSkin, name);
1697 if (!this.isCSSLoaded(skinmod, this._boot)) {
1703 mod._parsed = false;
1707 if (mod.lang && !mod.langPack && Y.Intl) {
1708 lang = Y.Intl.lookupBestLang(this.lang || ROOT_LANG, mod.lang);
1709 //Y.log('Best lang: ' + lang + ', this.lang: ' + this.lang + ', mod.lang: ' + mod.lang);
1710 packName = this.getLangPackName(lang, name);
1712 d.unshift(packName);
1718 mod.expanded_map = yArray.hash(d);
1720 mod.expanded = YObject.keys(mod.expanded_map);
1722 return mod.expanded;
1725 * Check to see if named css module is already loaded on the page
1726 * @method isCSSLoaded
1727 * @param {String} name The name of the css file
1730 isCSSLoaded: function(name, skip) {
1731 //TODO - Make this call a batching call with name being an array
1732 if (!name || !YUI.Env.cssStampEl || (!skip && this.ignoreRegistered)) {
1733 Y.log('isCSSLoaded was skipped for ' + name, 'warn', 'loader');
1736 var el = YUI.Env.cssStampEl,
1738 mod = YUI.Env._cssLoaded[name],
1739 style = el.currentStyle; //IE
1742 if (mod !== undefined) {
1743 //Y.log('isCSSLoaded was cached for ' + name, 'warn', 'loader');
1747 //Add the classname to the element
1748 el.className = name;
1751 style = Y.config.doc.defaultView.getComputedStyle(el, null);
1754 if (style && style.display === 'none') {
1758 Y.log('Has Skin? ' + name + ' : ' + ret, 'info', 'loader');
1760 el.className = ''; //Reset the classname to ''
1762 YUI.Env._cssLoaded[name] = ret;
1768 * Returns a hash of module names the supplied module satisfies.
1769 * @method getProvides
1770 * @param {string} name The name of the module.
1771 * @return {object} what this module provides.
1773 getProvides: function(name) {
1774 var m = this.getModule(name), o, s;
1775 // supmap = this.provides;
1781 if (m && !m.provides) {
1786 yArray.each(s, function(v) {
1787 Y.mix(o, this.getProvides(v));
1800 * Calculates the dependency tree, the result is stored in the sorted
1803 * @param {object} o optional options object.
1804 * @param {string} type optional argument to prune modules.
1806 calculate: function(o, type) {
1807 if (o || type || this.dirty) {
1819 if (this.allowRollup) {
1822 this._explodeRollups();
1829 * Creates a "psuedo" package for languages provided in the lang array
1830 * @method _addLangPack
1832 * @param {String} lang The language to create
1833 * @param {Object} m The module definition to create the language pack around
1834 * @param {String} packName The name of the package (e.g: lang/datatype-date-en-US)
1835 * @return {Object} The module definition
1837 _addLangPack: function(lang, m, packName) {
1840 existing = this.moduleInfo[packName];
1844 packPath = _path((m.pkg || name), packName, JS, true);
1862 conf.configFn = m.configFn;
1865 this.addModule(conf, packName);
1868 Y.Env.lang = Y.Env.lang || {};
1869 Y.Env.lang[lang] = Y.Env.lang[lang] || {};
1870 Y.Env.lang[lang][name] = true;
1874 return this.moduleInfo[packName];
1878 * Investigates the current YUI configuration on the page. By default,
1879 * modules already detected will not be loaded again unless a force
1880 * option is encountered. Called by calculate()
1884 _setup: function() {
1885 var info = this.moduleInfo, name, i, j, m, l,
1888 for (name in info) {
1889 if (info.hasOwnProperty(name)) {
1894 //m.requires = YObject.keys(yArray.hash(m.requires));
1895 m.requires = yArray.dedupe(m.requires);
1897 // Create lang pack modules
1898 //if (m.lang && m.lang.length) {
1900 // Setup root package if the module has lang defined,
1901 // it needs to provide a root language pack
1902 packName = this.getLangPackName(ROOT_LANG, name);
1903 this._addLangPack(null, m, packName);
1911 //l = Y.merge(this.inserted);
1914 // available modules
1915 if (!this.ignoreRegistered) {
1916 Y.mix(l, GLOBAL_ENV.mods);
1919 // add the ignore list to the list of loaded packages
1921 Y.mix(l, yArray.hash(this.ignore));
1924 // expand the list to include superseded modules
1926 if (l.hasOwnProperty(j)) {
1927 Y.mix(l, this.getProvides(j));
1931 // remove modules on the force list from the loaded list
1933 for (i = 0; i < this.force.length; i++) {
1934 if (this.force[i] in l) {
1935 delete l[this.force[i]];
1940 Y.mix(this.loaded, l);
1946 * Builds a module name for a language pack
1947 * @method getLangPackName
1948 * @param {string} lang the language code.
1949 * @param {string} mname the module to build it for.
1950 * @return {string} the language pack module name.
1952 getLangPackName: function(lang, mname) {
1953 return ('lang/' + mname + ((lang) ? '_' + lang : ''));
1956 * Inspects the required modules list looking for additional
1957 * dependencies. Expands the required list to include all
1958 * required modules. Called by calculate()
1962 _explode: function() {
1963 //TODO Move done out of scope
1964 var r = this.required, m, reqs, done = {},
1965 self = this, name, expound;
1967 // the setup phase is over, all modules have been created
1970 self._explodeRollups();
1974 if (r.hasOwnProperty(name)) {
1977 m = self.getModule(name);
1979 expound = m.expound;
1982 r[expound] = self.getModule(expound);
1983 reqs = self.getRequires(r[expound]);
1984 Y.mix(r, yArray.hash(reqs));
1987 reqs = self.getRequires(m);
1988 Y.mix(r, yArray.hash(reqs));
1994 // Y.log('After explode: ' + YObject.keys(r));
1997 * The default method used to test a module against a pattern
1998 * @method _patternTest
2000 * @param {String} mname The module being tested
2001 * @param {String} pname The pattern to match
2003 _patternTest: function(mname, pname) {
2004 return (mname.indexOf(pname) > -1);
2007 * Get's the loader meta data for the requested module
2009 * @param {String} mname The module name to get
2010 * @return {Object} The module metadata
2012 getModule: function(mname) {
2013 //TODO: Remove name check - it's a quick hack to fix pattern WIP
2018 var p, found, pname,
2019 m = this.moduleInfo[mname],
2020 patterns = this.patterns;
2022 // check the patterns library to see if we should automatically add
2023 // the module with defaults
2024 if (!m || (m && m.ext)) {
2025 // Y.log('testing patterns ' + YObject.keys(patterns));
2026 for (pname in patterns) {
2027 if (patterns.hasOwnProperty(pname)) {
2028 // Y.log('testing pattern ' + i);
2029 p = patterns[pname];
2031 //There is no test method, create a default one that tests
2032 // the pattern against the mod name
2034 p.test = this._patternTest;
2037 if (p.test(mname, pname)) {
2038 // use the metadata supplied for the pattern
2039 // as the module definition.
2050 // Y.log('executing pattern action: ' + pname);
2051 p.action.call(this, mname, pname);
2053 Y.log('Undefined module: ' + mname + ', matched a pattern: ' +
2054 pname, 'info', 'loader');
2055 // ext true or false?
2056 m = this.addModule(Y.merge(found), mname);
2057 if (found.configFn) {
2058 m.configFn = found.configFn;
2064 if (found && m && found.configFn && !m.configFn) {
2065 m.configFn = found.configFn;
2073 // impl in rollup submodule
2074 _rollup: function() { },
2077 * Remove superceded modules and loaded modules. Called by
2078 * calculate() after we have the mega list of all dependencies
2080 * @return {object} the reduced dependency hash.
2083 _reduce: function(r) {
2085 r = r || this.required;
2087 var i, j, s, m, type = this.loadType,
2088 ignore = this.ignore ? yArray.hash(this.ignore) : false;
2091 if (r.hasOwnProperty(i)) {
2092 m = this.getModule(i);
2093 // remove if already loaded
2094 if (((this.loaded[i] || ON_PAGE[i]) &&
2095 !this.forceMap[i] && !this.ignoreRegistered) ||
2096 (type && m && m.type !== type)) {
2099 if (ignore && ignore[i]) {
2102 // remove anything this module supersedes
2103 s = m && m.supersedes;
2105 for (j = 0; j < s.length; j++) {
2117 * Handles the queue when a module has been loaded for all cases
2120 * @param {String} msg The message from Loader
2121 * @param {Boolean} success A boolean denoting success or failure
2123 _finish: function(msg, success) {
2124 Y.log('loader finishing: ' + msg + ', ' + Y.id + ', ' +
2125 this.data, 'info', 'loader');
2127 _queue.running = false;
2129 var onEnd = this.onEnd;
2131 onEnd.call(this.context, {
2140 * The default Loader onSuccess handler, calls this.onSuccess with a payload
2141 * @method _onSuccess
2144 _onSuccess: function() {
2145 var self = this, skipped = Y.merge(self.skipped), fn,
2146 failed = [], rreg = self.requireRegistration,
2147 success, msg, i, mod;
2149 for (i in skipped) {
2150 if (skipped.hasOwnProperty(i)) {
2151 delete self.inserted[i];
2157 for (i in self.inserted) {
2158 if (self.inserted.hasOwnProperty(i)) {
2159 mod = self.getModule(i);
2160 if (mod && rreg && mod.type === JS && !(i in YUI.Env.mods)) {
2163 Y.mix(self.loaded, self.getProvides(i));
2168 fn = self.onSuccess;
2169 msg = (failed.length) ? 'notregistered' : 'success';
2170 success = !(failed.length);
2172 fn.call(self.context, {
2180 self._finish(msg, success);
2183 * The default Loader onProgress handler, calls this.onProgress with a payload
2184 * @method _onProgress
2187 _onProgress: function(e) {
2189 //set the internal cache to what just came in.
2190 if (e.data && e.data.length) {
2191 for (i = 0; i < e.data.length; i++) {
2192 e.data[i] = self.getModule(e.data[i].name);
2195 if (self.onProgress) {
2196 self.onProgress.call(self.context, {
2203 * The default Loader onFailure handler, calls this.onFailure with a payload
2204 * @method _onFailure
2207 _onFailure: function(o) {
2208 var f = this.onFailure, msg = [], i = 0, len = o.errors.length;
2210 for (i; i < len; i++) {
2211 msg.push(o.errors[i].error);
2214 msg = msg.join(',');
2216 Y.log('load error: ' + msg + ', ' + Y.id, 'error', 'loader');
2219 f.call(this.context, {
2226 this._finish(msg, false);
2231 * The default Loader onTimeout handler, calls this.onTimeout with a payload
2232 * @method _onTimeout
2233 * @param {Get.Transaction} transaction The Transaction object from `Y.Get`
2236 _onTimeout: function(transaction) {
2237 Y.log('loader timeout: ' + Y.id, 'error', 'loader');
2238 var f = this.onTimeout;
2240 f.call(this.context, {
2244 transaction: transaction
2250 * Sorts the dependency tree. The last step of calculate()
2256 // create an indexed list
2257 var s = YObject.keys(this.required),
2258 // loaded = this.loaded,
2259 //TODO Move this out of scope
2261 p = 0, l, a, b, j, k, moved, doneKey;
2263 // keep going until we make a pass without moving anything
2269 // start the loop after items that are already sorted
2270 for (j = p; j < l; j++) {
2272 // check the next module on the list to see if its
2273 // dependencies have been met
2276 // check everything below current item and move if we
2277 // find a requirement for the current item
2278 for (k = j + 1; k < l; k++) {
2281 if (!done[doneKey] && this._requires(a, s[k])) {
2283 // extract the dependency so we can move it up
2286 // insert the dependency above the item that
2288 s.splice(j, 0, b[0]);
2290 // only swap two dependencies once to short circut
2291 // circular dependencies
2292 done[doneKey] = true;
2301 // jump out of loop if we moved something
2304 // this item is sorted, move our pointer and keep going
2310 // when we make it here and moved is false, we are
2322 * Handles the actual insertion of script/link tags
2325 * @param {Object} source The YUI instance the request came from
2326 * @param {Object} o The metadata to include
2327 * @param {String} type JS or CSS
2328 * @param {Boolean} [skipcalc=false] Do a Loader.calculate on the meta
2330 _insert: function(source, o, type, skipcalc) {
2332 Y.log('private _insert() ' + (type || '') + ', ' + Y.id, "info", "loader");
2334 // restore the state at the time of the request
2336 this._config(source);
2339 // build the dependency list
2340 // don't include type so we can process CSS and script in
2341 // one pass when the type is not specified.
2343 var modules = this.resolve(!skipcalc),
2344 self = this, comp = 0, actions = 0,
2345 mods = {}, deps, complete;
2350 //Filter out the opposite type and reset the array so the checks later work
2351 modules[((type === JS) ? CSS : JS)] = [];
2353 if (!self.fetchCSS) {
2356 if (modules.js.length) {
2359 if (modules.css.length) {
2363 //console.log('Resolved Modules: ', modules);
2365 complete = function(d) {
2367 var errs = {}, i = 0, o = 0, u = '', fn,
2370 if (d && d.errors) {
2371 for (i = 0; i < d.errors.length; i++) {
2372 if (d.errors[i].request) {
2373 u = d.errors[i].request.url;
2381 if (d && d.data && d.data.length && (d.type === 'success')) {
2382 for (i = 0; i < d.data.length; i++) {
2383 self.inserted[d.data[i].name] = true;
2384 //If the external module has a skin or a lang, reprocess it
2385 if (d.data[i].lang || d.data[i].skinnable) {
2386 delete self.inserted[d.data[i].name];
2387 self._refetch.push(d.data[i].name);
2392 if (actions === comp) {
2393 self._loading = null;
2394 Y.log('Loader actions complete!', 'info', 'loader');
2395 if (self._refetch.length) {
2396 //Get the deps for the new meta-data and reprocess
2397 Y.log('Found potential modules to refetch', 'info', 'loader');
2398 for (i = 0; i < self._refetch.length; i++) {
2399 deps = self.getRequires(self.getModule(self._refetch[i]));
2400 for (o = 0; o < deps.length; o++) {
2401 if (!self.inserted[deps[o]]) {
2402 //We wouldn't be to this point without the module being here
2403 mods[deps[o]] = deps[o];
2407 mods = Y.Object.keys(mods);
2409 Y.log('Refetching modules with new meta-data', 'info', 'loader');
2411 resMods = self.resolve(true);
2412 if (resMods.cssMods.length) {
2413 for (i=0; i < resMods.cssMods.length; i++) {
2414 modName = resMods.cssMods[i].name;
2415 delete YUI.Env._cssLoaded[modName];
2416 if (self.isCSSLoaded(modName)) {
2417 self.inserted[modName] = true;
2418 delete self.required[modName];
2425 self._insert(); //insert the new deps
2429 Y.log('Firing final Loader callback!', 'info', 'loader');
2437 this._loading = true;
2439 if (!modules.js.length && !modules.css.length) {
2440 Y.log('No modules resolved..', 'warn', 'loader');
2449 if (modules.css.length) { //Load CSS first
2450 Y.log('Loading CSS modules', 'info', 'loader');
2451 Y.Get.css(modules.css, {
2452 data: modules.cssMods,
2453 attributes: self.cssAttributes,
2454 insertBefore: self.insertBefore,
2455 charset: self.charset,
2456 timeout: self.timeout,
2458 onProgress: function(e) {
2459 self._onProgress.call(self, e);
2461 onTimeout: function(d) {
2462 self._onTimeout.call(self, d);
2464 onSuccess: function(d) {
2466 d.fn = self._onSuccess;
2467 complete.call(self, d);
2469 onFailure: function(d) {
2471 d.fn = self._onFailure;
2472 complete.call(self, d);
2477 if (modules.js.length) {
2478 Y.log('Loading JS modules', 'info', 'loader');
2479 Y.Get.js(modules.js, {
2480 data: modules.jsMods,
2481 insertBefore: self.insertBefore,
2482 attributes: self.jsAttributes,
2483 charset: self.charset,
2484 timeout: self.timeout,
2488 onProgress: function(e) {
2489 self._onProgress.call(self, e);
2491 onTimeout: function(d) {
2492 self._onTimeout.call(self, d);
2494 onSuccess: function(d) {
2496 d.fn = self._onSuccess;
2497 complete.call(self, d);
2499 onFailure: function(d) {
2501 d.fn = self._onFailure;
2502 complete.call(self, d);
2508 * Once a loader operation is completely finished, process any additional queued items.
2512 _continue: function() {
2513 if (!(_queue.running) && _queue.size() > 0) {
2514 _queue.running = true;
2520 * inserts the requested modules and their dependencies.
2521 * <code>type</code> can be "js" or "css". Both script and
2522 * css are inserted if type is not provided.
2524 * @param {object} o optional options object.
2525 * @param {string} type the type of dependency to insert.
2527 insert: function(o, type, skipsort) {
2528 Y.log('public insert() ' + (type || '') + ', ' +
2529 Y.Object.keys(this.required), "info", "loader");
2530 var self = this, copy = Y.merge(this);
2531 delete copy.require;
2533 _queue.add(function() {
2534 self._insert(copy, o, type, skipsort);
2540 * Executed every time a module is loaded, and if we are in a load
2541 * cycle, we attempt to load the next script. Public so that it
2542 * is possible to call this if using a method other than
2543 * Y.register to determine when scripts are fully loaded
2546 * @param {string} mname optional the name of the module that has
2547 * been loaded (which is usually why it is time to load the next
2550 loadNext: function() {
2551 Y.log('loadNext was called..', 'error', 'loader');
2556 * Apply filter defined for this instance to a url/path
2558 * @param {string} u the string to filter.
2559 * @param {string} name the name of the module, if we are processing
2560 * a single module as opposed to a combined url.
2561 * @return {string} the filtered string.
2564 _filter: function(u, name, group) {
2565 var f = this.filter,
2566 hasFilter = name && (name in this.filters),
2567 modFilter = hasFilter && this.filters[name],
2568 groupName = group || (this.moduleInfo[name] ? this.moduleInfo[name].group : null);
2570 if (groupName && this.groups[groupName] && this.groups[groupName].filter) {
2571 modFilter = this.groups[groupName].filter;
2577 f = (L.isString(modFilter)) ? this.FILTER_DEFS[modFilter.toUpperCase()] || null : modFilter;
2580 u = u.replace(new RegExp(f.searchExp, 'g'), f.replaceStr);
2587 * Generates the full url for a module
2589 * @param {string} path the path fragment.
2590 * @param {String} name The name of the module
2591 * @param {String} [base=self.base] The base url to use
2592 * @return {string} the full url.
2595 _url: function(path, name, base) {
2596 return this._filter((base || this.base || '') + path, name);
2599 * Returns an Object hash of file arrays built from `loader.sorted` or from an arbitrary list of sorted modules.
2601 * @param {Boolean} [calc=false] Perform a loader.calculate() before anything else
2602 * @param {Array} [s=loader.sorted] An override for the loader.sorted array
2603 * @return {Object} Object hash (js and css) of two arrays of file lists
2604 * @example This method can be used as an off-line dep calculator
2607 * var loader = new Y.Loader({
2612 * require: ['node', 'dd', 'console']
2614 * var out = loader.resolve(true);
2617 resolve: function(calc, s) {
2619 var len, i, m, url, group, groupName, j, frag,
2620 comboSource, comboSources, mods, comboBase,
2621 base, urls, u = [], tmpBase, baseLen, resCombos = {},
2622 self = this, comboSep, maxURLLength,
2623 inserted = (self.ignoreRegistered) ? {} : self.inserted,
2624 resolved = { js: [], jsMods: [], css: [], cssMods: [] },
2625 type = self.loadType || 'js', addSingle;
2627 if (self.skin.overrides || self.skin.defaultSkin !== DEFAULT_SKIN || self.ignoreRegistered) {
2628 self._resetModules();
2634 s = s || self.sorted;
2636 addSingle = function(m) {
2639 group = (m.group && self.groups[m.group]) || NOT_FOUND;
2641 //Always assume it's async
2642 if (group.async === false) {
2643 m.async = group.async;
2646 url = (m.fullpath) ? self._filter(m.fullpath, s[i]) :
2647 self._url(m.path, s[i], group.base || m.base);
2649 if (m.attributes || m.async === false) {
2655 url.attributes = m.attributes;
2658 resolved[m.type].push(url);
2659 resolved[m.type + 'Mods'].push(m);
2661 Y.log('Undefined Module', 'warn', 'loader');
2668 // the default combo base
2669 comboBase = self.comboBase;
2675 for (i = 0; i < len; i++) {
2676 comboSource = comboBase;
2677 m = self.getModule(s[i]);
2678 groupName = m && m.group;
2679 group = self.groups[groupName];
2680 if (groupName && group) {
2682 if (!group.combine || m.fullpath) {
2683 //This is not a combo module, skip it and load it singly later.
2688 if (group.comboBase) {
2689 comboSource = group.comboBase;
2692 if ("root" in group && L.isValue(group.root)) {
2693 m.root = group.root;
2695 m.comboSep = group.comboSep || self.comboSep;
2696 m.maxURLLength = group.maxURLLength || self.maxURLLength;
2698 if (!self.combine) {
2699 //This is not a combo module, skip it and load it singly later.
2705 comboSources[comboSource] = comboSources[comboSource] || [];
2706 comboSources[comboSource].push(m);
2709 for (j in comboSources) {
2710 if (comboSources.hasOwnProperty(j)) {
2711 resCombos[j] = resCombos[j] || { js: [], jsMods: [], css: [], cssMods: [] };
2713 mods = comboSources[j];
2717 for (i = 0; i < len; i++) {
2718 if (inserted[mods[i]]) {
2722 // Do not try to combine non-yui JS unless combo def
2724 if (m && (m.combine || !m.ext)) {
2725 resCombos[j].comboSep = m.comboSep;
2726 resCombos[j].group = m.group;
2727 resCombos[j].maxURLLength = m.maxURLLength;
2728 frag = ((L.isValue(m.root)) ? m.root : self.root) + (m.path || m.fullpath);
2729 frag = self._filter(frag, m.name);
2730 resCombos[j][m.type].push(frag);
2731 resCombos[j][m.type + 'Mods'].push(m);
2733 //Add them to the next process..
2745 for (j in resCombos) {
2746 if (resCombos.hasOwnProperty(j)) {
2748 comboSep = resCombos[base].comboSep || self.comboSep;
2749 maxURLLength = resCombos[base].maxURLLength || self.maxURLLength;
2750 Y.log('Using maxURLLength of ' + maxURLLength, 'info', 'loader');
2751 for (type in resCombos[base]) {
2752 if (type === JS || type === CSS) {
2753 urls = resCombos[base][type];
2754 mods = resCombos[base][type + 'Mods'];
2756 tmpBase = base + urls.join(comboSep);
2757 baseLen = tmpBase.length;
2758 if (maxURLLength <= base.length) {
2759 Y.log('maxURLLength (' + maxURLLength + ') is lower than the comboBase length (' + base.length + '), resetting to default (' + MAX_URL_LENGTH + ')', 'error', 'loader');
2760 maxURLLength = MAX_URL_LENGTH;
2764 if (baseLen > maxURLLength) {
2765 Y.log('Exceeded maxURLLength (' + maxURLLength + ') for ' + type + ', splitting', 'info', 'loader');
2767 for (s = 0; s < len; s++) {
2769 tmpBase = base + u.join(comboSep);
2771 if (tmpBase.length > maxURLLength) {
2773 tmpBase = base + u.join(comboSep);
2774 resolved[type].push(self._filter(tmpBase, null, resCombos[base].group));
2782 tmpBase = base + u.join(comboSep);
2783 resolved[type].push(self._filter(tmpBase, null, resCombos[base].group));
2786 resolved[type].push(self._filter(tmpBase, null, resCombos[base].group));
2789 resolved[type + 'Mods'] = resolved[type + 'Mods'].concat(mods);
2800 Shortcut to calculate, resolve and load all modules.
2802 var loader = new Y.Loader({
2803 ignoreRegistered: true,
2811 loader.load(function() {
2812 console.log('All modules have loaded..');
2817 @param {Callback} cb Executed after all load operations are complete
2819 load: function(cb) {
2821 Y.log('No callback supplied to load()', 'error', 'loader');
2825 out = self.resolve(true);
2829 self.onEnd = function() {
2830 cb.apply(self.context || self, arguments);
2839 }, '3.13.0', {"requires": ["get", "features"]});
2840 YUI.add('loader-rollup', function (Y, NAME) {
2843 * Optional automatic rollup logic for reducing http connections
2844 * when not using a combo service.
2850 * Look for rollup packages to determine if all of the modules a
2851 * rollup supersedes are required. If so, include the rollup to
2852 * help reduce the total number of connections required. Called
2853 * by calculate(). This is an optional feature, and requires the
2854 * appropriate submodule to function.
2859 Y.Loader.prototype._rollup = function() {
2860 var i, j, m, s, r = this.required, roll,
2861 info = this.moduleInfo, rolled, c, smod;
2863 // find and cache rollup modules
2864 if (this.dirty || !this.rollups) {
2867 if (info.hasOwnProperty(i)) {
2868 m = this.getModule(i);
2869 // if (m && m.rollup && m.supersedes) {
2870 if (m && m.rollup) {
2871 this.rollups[i] = m;
2877 // make as many passes as needed to pick up rollup rollups
2881 // go through the rollup candidates
2882 for (i in this.rollups) {
2883 if (this.rollups.hasOwnProperty(i)) {
2884 // there can be only one, unless forced
2885 if (!r[i] && ((!this.loaded[i]) || this.forceMap[i])) {
2886 m = this.getModule(i);
2887 s = m.supersedes || [];
2890 // @TODO remove continue
2897 // check the threshold
2898 for (j = 0; j < s.length; j++) {
2901 // if the superseded module is loaded, we can't
2902 // load the rollup unless it has been forced.
2903 if (this.loaded[s[j]] && !this.forceMap[s[j]]) {
2906 // increment the counter if this module is required.
2907 // if we are beyond the rollup threshold, we will
2908 // use the rollup module
2909 } else if (r[s[j]] && m.type === smod.type) {
2911 // Y.log("adding to thresh: " + c + ", " + s[j]);
2912 roll = (c >= m.rollup);
2914 // Y.log("over thresh " + c + ", " + s[j]);
2921 // Y.log("adding rollup: " + i);
2926 // expand the rollup's dependencies
2927 this.getRequires(m);
2933 // if we made it here w/o rolling up something, we are done
2941 }, '3.13.0', {"requires": ["loader-base"]});
2942 YUI.add('loader-yui3', function (Y, NAME) {
2944 /* This file is auto-generated by (yogi.js loader --mix --yes) */
2946 /*jshint maxlen:900, eqeqeq: false */
2949 * YUI 3 module metadata
2951 * @submodule loader-yui3
2953 YUI.Env[Y.version].modules = YUI.Env[Y.version].modules || {};
2954 Y.mix(YUI.Env[Y.version].modules, {
2993 "anim-node-plugin": {
3012 "anim-shape-transform": {
3052 "app-transitions": {
3057 "app-transitions-css": {
3060 "app-transitions-native": {
3062 "name": "app-transitions-native",
3063 "test": function (Y) {
3064 var doc = Y.config.doc,
3065 node = doc ? doc.documentElement : null;
3067 if (node && node.style) {
3068 return ('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style);
3073 "trigger": "app-transitions"
3077 "app-transitions-css",
3102 "arraylist-filter": {
3126 "attribute-observable",
3130 "attribute-complex": {
3140 "attribute-events": {
3142 "attribute-observable"
3145 "attribute-extras": {
3150 "attribute-observable": {
3157 "autocomplete-base",
3158 "autocomplete-sources",
3159 "autocomplete-list",
3160 "autocomplete-plugin"
3163 "autocomplete-base": {
3165 "autocomplete-sources"
3171 "event-valuechange",
3175 "autocomplete-filters": {
3181 "autocomplete-filters-accentfold": {
3188 "autocomplete-highlighters": {
3194 "autocomplete-highlighters-accentfold": {
3197 "highlight-accentfold"
3200 "autocomplete-list": {
3202 "autocomplete-sources"
3211 "autocomplete-base",
3218 "widget-position-align"
3222 "autocomplete-list-keys": {
3224 "name": "autocomplete-list-keys",
3225 "test": function (Y) {
3226 // Only add keyboard support to autocomplete-list if this doesn't appear to
3227 // be an iOS or Android-based mobile device.
3229 // There's currently no feasible way to actually detect whether a device has
3230 // a hardware keyboard, so this sniff will have to do. It can easily be
3231 // overridden by manually loading the autocomplete-list-keys module.
3233 // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari
3234 // doesn't fire the keyboard events used by AutoCompleteList, so there's
3235 // no point loading the -keys module even when a bluetooth keyboard may be
3237 return !(Y.UA.ios || Y.UA.android);
3239 "trigger": "autocomplete-list"
3242 "autocomplete-list",
3246 "autocomplete-plugin": {
3248 "autocomplete-list",
3252 "autocomplete-sources": {
3273 "axis-numeric-base",
3274 "axis-category-base",
3301 "axis-category-base"
3304 "axis-category-base": {
3315 "axis-numeric-base": {
3326 "axis-stacked-base": {
3366 "base-observable": {
3368 "attribute-observable"
3371 "base-pluginhost": {
3460 "datatype-date-math",
3465 "calendarnavigator": {
3493 "series-areaspline",
3495 "series-combospline",
3496 "series-line-stacked",
3497 "series-marker-stacked",
3498 "series-area-stacked",
3499 "series-spline-stacked",
3500 "series-column-stacked",
3501 "series-bar-stacked",
3502 "series-areaspline-stacked",
3503 "series-combo-stacked",
3504 "series-combospline-stacked"
3512 "classnamemanager": {
3572 "console-filters": {
3579 "content-editable": {
3597 "createlink-base": {
3613 "cssbase-context": {
3630 "cssfonts-context": {
3645 "cssgrids-responsive": {
3651 "cssgrids-responsive-base"
3667 "cssnormalize-context": {
3673 "cssreset-context": {
3685 "dataschema-array": {
3690 "dataschema-base": {
3695 "dataschema-json": {
3701 "dataschema-text": {
3716 "datasource-function",
3718 "datasource-jsonschema",
3719 "datasource-xmlschema",
3720 "datasource-arrayschema",
3721 "datasource-textschema",
3722 "datasource-polling"
3725 "datasource-arrayschema": {
3732 "datasource-cache": {
3739 "datasource-function": {
3756 "datasource-jsonschema": {
3763 "datasource-local": {
3768 "datasource-polling": {
3773 "datasource-textschema": {
3780 "datasource-xmlschema": {
3795 "datatable-column-widths",
3796 "datatable-message",
3797 "datatable-mutable",
3799 "datatable-datasource"
3820 "datatable-column-widths": {
3829 "node-event-delegate"
3832 "datatable-datasource": {
3845 "datatable-formatters": {
3848 "datatype-number-format",
3849 "datatype-date-format",
3860 "datatable-highlight": {
3867 "datatable-message": {
3880 "datatable-mutable": {
3885 "datatable-paginator": {
3895 "datatable-paginator-templates"
3899 "datatable-paginator-templates": {
3904 "datatable-scroll": {
3907 "datatable-column-widths",
3924 "datatable-table": {
3942 "datatype-date-parse",
3943 "datatype-date-format",
3944 "datatype-date-math"
3947 "datatype-date-format": {
4032 "datatype-date-math": {
4037 "datatype-date-parse": {},
4038 "datatype-number": {
4040 "datatype-number-parse",
4041 "datatype-number-format"
4044 "datatype-number-format": {},
4045 "datatype-number-parse": {},
4048 "datatype-xml-parse",
4049 "datatype-xml-format"
4052 "datatype-xml-format": {},
4053 "datatype-xml-parse": {},
4116 "name": "dd-gestures",
4117 "trigger": "dd-drag",
4118 "ua": "touchEnabled"
4196 "name": "dom-style-ie",
4197 "test": function (Y) {
4199 var testFeature = Y.Features.test,
4200 addFeature = Y.Features.add,
4201 WINDOW = Y.config.win,
4202 DOCUMENT = Y.config.doc,
4203 DOCUMENT_ELEMENT = 'documentElement',
4206 addFeature('style', 'computedStyle', {
4208 return WINDOW && 'getComputedStyle' in WINDOW;
4212 addFeature('style', 'opacity', {
4214 return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style;
4218 ret = (!testFeature('style', 'opacity') &&
4219 !testFeature('style', 'computedStyle'));
4223 "trigger": "dom-style"
4282 "editor-para-base": {
4289 "name": "editor-para-ie",
4290 "trigger": "editor-para",
4298 "editor-selection": {
4331 "event-valuechange",
4348 "name": "event-base-ie",
4349 "test": function(Y) {
4350 var imp = Y.config.doc && Y.config.doc.implementation;
4351 return (imp && (!imp.hasFeature('Events', '2.0')));
4353 "trigger": "node-base"
4359 "event-contextmenu": {
4367 "event-custom-base",
4368 "event-custom-complex"
4371 "event-custom-base": {
4376 "event-custom-complex": {
4414 "event-mouseenter": {
4419 "event-mousewheel": {
4447 "event-synthetic": {
4450 "event-custom-complex"
4466 "event-valuechange": {
4507 "gesture-simulate": {
4528 "graphics-canvas": {
4530 "name": "graphics-canvas",
4531 "test": function(Y) {
4532 var DOCUMENT = Y.config.doc,
4533 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas",
4534 canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
4535 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
4536 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d"));
4538 "trigger": "graphics"
4544 "graphics-canvas-default": {
4546 "name": "graphics-canvas-default",
4547 "test": function(Y) {
4548 var DOCUMENT = Y.config.doc,
4549 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas",
4550 canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
4551 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
4552 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d"));
4554 "trigger": "graphics"
4564 "name": "graphics-svg",
4565 "test": function(Y) {
4566 var DOCUMENT = Y.config.doc,
4567 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas",
4568 canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
4569 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
4571 return svg && (useSVG || !canvas);
4573 "trigger": "graphics"
4579 "graphics-svg-default": {
4581 "name": "graphics-svg-default",
4582 "test": function(Y) {
4583 var DOCUMENT = Y.config.doc,
4584 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas",
4585 canvas = DOCUMENT && DOCUMENT.createElement("canvas"),
4586 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"));
4588 return svg && (useSVG || !canvas);
4590 "trigger": "graphics"
4595 "name": "graphics-vml",
4596 "test": function(Y) {
4597 var DOCUMENT = Y.config.doc,
4598 canvas = DOCUMENT && DOCUMENT.createElement("canvas");
4599 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
4601 "trigger": "graphics"
4607 "graphics-vml-default": {
4609 "name": "graphics-vml-default",
4610 "test": function(Y) {
4611 var DOCUMENT = Y.config.doc,
4612 canvas = DOCUMENT && DOCUMENT.createElement("canvas");
4613 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d")));
4615 "trigger": "graphics"
4620 "handlebars-compiler"
4623 "handlebars-base": {
4626 "handlebars-compiler": {
4634 "highlight-accentfold"
4637 "highlight-accentfold": {
4661 "event-custom-complex"
4674 "history-hash-ie": {
4676 "name": "history-hash-ie",
4677 "test": function (Y) {
4678 var docMode = Y.config.doc && Y.config.doc.documentMode;
4680 return Y.UA.ie && (!('onhashchange' in Y.config.win) ||
4681 !docMode || docMode < 8);
4683 "trigger": "history-hash"
4729 "event-custom-base",
4730 "querystring-stringify-simple"
4741 "name": "io-nodejs",
4742 "trigger": "io-base",
4755 "io-upload-iframe": {
4764 "datatype-xml-parse"
4778 "json-parse-shim": {
4780 "name": "json-parse-shim",
4781 "test": function (Y) {
4782 var _JSON = Y.config.global.JSON,
4783 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON,
4784 nativeSupport = Y.config.useNativeJSONParse !== false && !!Native;
4786 function workingNative( k, v ) {
4787 return k === "ok" ? true : v;
4790 // Double check basic functionality. This is mainly to catch early broken
4791 // implementations of the JSON API in Firefox 3.1 beta1 and beta2
4792 if ( nativeSupport ) {
4794 nativeSupport = ( Native.parse( '{"ok":false}', workingNative ) ).ok;
4797 nativeSupport = false;
4801 return !nativeSupport;
4803 "trigger": "json-parse"
4814 "json-stringify-shim": {
4816 "name": "json-stringify-shim",
4817 "test": function (Y) {
4818 var _JSON = Y.config.global.JSON,
4819 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON,
4820 nativeSupport = Y.config.useNativeJSONStringify !== false && !!Native;
4822 // Double check basic native functionality. This is primarily to catch broken
4823 // early JSON API implementations in Firefox 3.1 beta1 and beta2.
4824 if ( nativeSupport ) {
4826 nativeSupport = ( '0' === Native.stringify(0) );
4828 nativeSupport = false;
4833 return !nativeSupport;
4835 "trigger": "json-stringify"
4852 "lazy-model-list": {
4903 "model-sync-local": {
4909 "model-sync-rest": {
4919 "node-event-delegate",
4939 "node-event-delegate": {
4945 "node-event-html5": {
4950 "node-event-simulate": {
4966 "node-focusmanager": {
4971 "node-event-simulate",
4991 "node-pluginhost": {
5003 "node-scroll-info": {
5029 "widget-position-align",
5031 "widget-position-constrain"
5057 "widget-position-align",
5058 "widget-position-constrain",
5078 "node-event-delegate",
5107 "pluginhost-base": {
5112 "pluginhost-config": {
5124 "querystring-parse",
5125 "querystring-stringify"
5128 "querystring-parse": {
5134 "querystring-parse-simple": {
5139 "querystring-stringify": {
5144 "querystring-stringify-simple": {
5157 "slider-value-range",
5175 "recordset-filter": {
5182 "recordset-indexer": {
5214 "resize-constrain": {
5248 "scrollview-scrollbars"
5251 "scrollview-base": {
5260 "scrollview-base-ie": {
5262 "name": "scrollview-base-ie",
5263 "trigger": "scrollview-base",
5270 "scrollview-list": {
5277 "scrollview-paginator": {
5283 "scrollview-scrollbars": {
5298 "name": "selector-css2",
5299 "test": function (Y) {
5300 var DOCUMENT = Y.config.doc,
5301 ret = DOCUMENT && !('querySelectorAll' in DOCUMENT);
5305 "trigger": "selector"
5317 "selector-native": {
5328 "series-area-stacked": {
5334 "series-areaspline": {
5340 "series-areaspline-stacked": {
5349 "series-histogram-base"
5352 "series-bar-stacked": {
5364 "series-candlestick": {
5369 "series-cartesian": {
5377 "series-histogram-base"
5380 "series-column-stacked": {
5394 "series-combo-stacked": {
5400 "series-combospline": {
5406 "series-combospline-stacked": {
5408 "series-combo-stacked",
5412 "series-curve-util": {},
5413 "series-fill-util": {},
5414 "series-histogram-base": {
5426 "series-line-stacked": {
5432 "series-line-util": {},
5439 "series-marker-stacked": {
5456 "series-plot-util": {},
5468 "series-spline-stacked": {
5488 "slider-value-range",
5501 "slider-value-range": {
5513 "sortable-scroll": {
5558 "node-event-delegate",
5604 "text-accentfold": {
5607 "text-data-accentfold"
5610 "text-data-accentfold": {
5615 "text-data-wordbreak": {
5623 "text-data-wordbreak"
5636 "transition-timer": {
5638 "name": "transition-timer",
5639 "test": function (Y) {
5640 var DOCUMENT = Y.config.doc,
5641 node = (DOCUMENT) ? DOCUMENT.documentElement: null,
5644 if (node && node.style) {
5645 ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style);
5650 "trigger": "transition"
5680 "tree-selectable": {
5711 "node-event-simulate",
5724 "node-event-delegate"
5735 "widget-htmlparser",
5747 "widget-autohide": {
5769 "name": "widget-base-ie",
5770 "trigger": "widget-base",
5790 "widget-htmlparser": {
5795 "widget-modality": {
5810 "widget-position": {
5817 "widget-position-align": {
5822 "widget-position-constrain": {
5845 "widget-uievents": {
5847 "node-event-delegate",
5858 "name": "yql-jsonp",
5859 "test": function (Y) {
5860 /* Only load the JSONP module when not in nodejs or winjs
5861 TODO Make the winjs module a CORS module
5863 return (!Y.UA.nodejs && !Y.UA.winjs);
5875 "name": "yql-nodejs",
5883 "name": "yql-winjs",
5907 YUI.Env[Y.version].md5 = '3cf02e5f307a6e9470df4ea0dc7eb41e';
5910 }, '3.13.0', {"requires": ["loader-base"]});
5911 YUI.add('loader', function (Y, NAME) {}, '3.13.0', {"use": ["loader-base", "loader-rollup", "loader-yui3"]});