loader-base.js revision c64978b48fe561f13e3d68afc70d7c528946359b
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * The YUI loader core
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * @module loader
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * @submodule loader-base
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs (function() {
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs GALLERY_VERSION = 'gallery-2010.12.01-21-32',
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs 'cssreset-context',
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs 'cssfonts-context']},
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs if (/-skin|reset|fonts|grids|base/.test(me.name)) {
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs // this makes skins in builds earlier than
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs // 2.6.0 work as long as combine is false
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * Loader dynamically loads script and css files. It includes the dependency
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * info for the version of the library in use, and will automatically pull in
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * dependencies for the modules requested. It supports rollup files and will
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * automatically use these when appropriate in order to minimize the number of
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * http connections required to load all of the dependencies. It can load the
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * files from the Yahoo! CDN, and it can utilize the combo service provided on
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * this network to reduce the number of http connections required to download
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * @module loader
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * @submodule loader-base
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * The component metadata is stored in Y.Env.meta.
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * Part of the loader module.
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * @property Env.meta
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * Loader dynamically loads script and css files. It includes the dependency
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * info for the version of the library in use, and will automatically pull in
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * dependencies for the modules requested. It supports rollup files and will
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * automatically use these when appropriate in order to minimize the number of
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * http connections required to load all of the dependencies. It can load the
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * files from the Yahoo! CDN, and it can utilize the combo service provided on
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * this network to reduce the number of http connections required to download
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * While the loader can be instantiated by the end user, it normally is not.
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * @see YUI.use for the normal use case. The use function automatically will
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * pull in missing dependencies.
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * @constructor
4c6011bfcf29cd75d6af86f192d709221f4d5d3aMareks Malnacs * @class Loader
* The YUI combo service base dir. Ex: http://yui.yahooapis.com/combo?</li>
* 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"
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() {
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];
for (j in val) {
groupName = j;
if (L.isString(f)) {
f = f.toUpperCase();
if (mod) {
if (mod) {
this.addModule({
return name;
self = this;
if (o.patterns) {
if (mods) {
}, self);
if (!o || !o.name) {
if (!o.type) {
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 (plugins) {
for (i in plugins) {
if (o.skinnable) {
if (o.condition) {
if (o.after) {
if (o.configFn) {
if (ret === false) {
this.dirty = true;
return NO_REQUIREMENTS;
r, old_mod,
hash;
hash = {};
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) {
if (go) {
if (intl) {
if (packName) {
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._reduce();
this._sort();
if (!existing) {
intl: true,
langPack: true,
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) {
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) {
success: true,
_onFailure: function(o) {
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) {
var self = this;
this._internalCallback = function() {
p = n.parentNode;
p.removeChild(n);
if (sib) {
p.appendChild(n);
this._loading = true;
this._combineComplete = {};
this.loadNext();
_continue: function() {
this._continue();
if (!this._loading) {
self = this,
handleSuccess = function(o) {
handleCombo = function(o) {
handleSuccess(o);
combining = [];
urls = [];
comboSources = {};
if (groupName) {
m.combine = false;
m.combine = true;
for (j in comboSources) {
url = j;
m = mods[i];
url = j;
autopurge: false,
if (mname) {
data: s[i],
autopurge: false,
if (fn) {
var f = this.filter,
if (hasFilter) {