yui-base.js revision 7380653a55868892cb97060c61641fc73ba22cbe
5643c7b4134ddde676793094a1c178f7e2614e3dMatt Sweeney * The YUI module contains the components required for building the YUI seed
5643c7b4134ddde676793094a1c178f7e2614e3dMatt Sweeney * file. This includes the script loading mechanism, a simple queue, and
5643c7b4134ddde676793094a1c178f7e2614e3dMatt Sweeney * the core utilities for the library.
5643c7b4134ddde676793094a1c178f7e2614e3dMatt Sweeney * @module yui
5643c7b4134ddde676793094a1c178f7e2614e3dMatt Sweeney * @submodule yui-base
* are store in Y.config. See config for the list of supported
var YUI = function() {
Y = new YUI();
Y._init();
if (gconf) {
Y._setup();
Y._setup();
NOOP = function() {},
instances = {},
} catch (ex) {}
handleLoad = function() {
if (hasWin) {
getLoader = function(Y, o) {
if (loader) {
//loader._config(Y.config);
return loader;
clobber = function(r, s) {
if (s.hasOwnProperty(i)) {
if (docClass) {
proto = {
* update the loader cache if necessary. Updating Y.config directly
applyConfig: function(o) {
o = o || NOOP;
var attr,
name,
for (name in o) {
if (loader) {
_config: function(o) {
this.applyConfig(o);
_init: function() {
var filter,
prop;
if (!Env) {
Y.Env = {
_used: {},
_attached: {},
_missed: [],
_loaded: {},
if (src) {
if (filter) {
debug: true,
useBrowserConsole: true,
throwFail: true,
bootstrap: true,
cacheUse: true,
fetchCSS: true,
use_rls: false
_setup: function(o) {
core = [],
if (instance) {
m = instance;
m = m[nest[i]];
mod = {
for (i in instances) {
if (loader) {
if (!done[r[i]]) {
name = r[i];
if (!mod) {
moot = true;
if (!moot) {
if (req) {
if (after) {
if (use) {
use: function() {
name,
provisioned = true;
callback = null;
provisioned = false;
if (provisioned) {
provisioned = false;
if (provisioned) {
if (Y._loading) {
} else if (callback) {
YArray = Y.Array,
missing = [],
ret = true,
if (!skip) {
success: true,
ret = true,
Y._loading = false;
if (data) {
missing = [];
if (redo) {
redo = false;
Y._loading = false;
if (data) {
if (ret) {
if (ret) {
handleLoader();
if (len) {
Y._loading = true;
var rls_end = function(o) {
handleLoader(o);
if (rls_url) {
rls_end(o);
rls_end({
Y._loading = true;
handleBoot = function() {
Y._loading = false;
if (ret) {
handleLoader();
namespace: function() {
for (; i < a.length; i++) {
arg = a[i];
var Y = this, ret;
var uid;
if (!uid) {
if (!readOnly) {
uid = null;
return uid;
destroy: function() {
if (Y.Event) {
delete Y.Env;
delete Y.config;
if (hasWin) {
handleLoad();
* The YUI combo service base dir. Ex: http://yui.yahooapis.com/combo?
* minified version of the files (e.g., event-min.js). The filter property
* <dd>Selects the debug versions of the library (e.g., event-debug.js).
* <dd>Selects the non-minified version of the library (e.g., event.js).</dd>
* 'replaceStr': "-debug.js"
* fullpath: 'http://myserver.mydomain.com/mymod1/mymod1.js'
* fullpath: 'http://myserver.mydomain.com/mymod2/mymod2.js'
* base: 'http://yui.yahooapis.com/2.8.0r4/build/',
* comboBase: 'http://yui.yahooapis.com/combo?',
* path: "yahoo-dom-event/yahoo-dom-event.js"
* path: "animation/animation.js",
* @default loader/loader-min.js
TYPES = {
SUBREGEX = /\{\s*([^|}]+?)\s*(?:\|([^}]*))?\s*\}/g,
TRIMREGEX = /^\s+|\s+$/g,
L.isBoolean = function(o) {
L.isFunction = function(o) {
L.isDate = function(o) {
L.isNull = function(o) {
L.isNumber = function(o) {
L.isString = function(o) {
L.isUndefined = function(o) {
return s.trimLeft();
return s.trimRight();
L.isValue = function(o) {
var t = L.type(o);
return isFinite(o);
L.type = function(o) {
L.sub = function(s, o) {
return new Date().getTime();
} catch (ex) {
result = [];
return result;
return [thing];
Y.Array = YArray;
} catch (ex) {}
return result;
var hash = {},
results = [],
return results;
if (i in array) {
var hash = {},
i, len;
if (i in keys) {
return hash;
function Queue() {
this._init();
_init: function() {
this._q = [];
next: function() {
last: function() {
add: function() {
size: function() {
Y.merge = function() {
Y.mix(o, a[i], true);
return receiver || Y;
if (mode) {
return receiver;
if (whitelist) {
if (Y.Object._hasEnumBug) {
return receiver;
return function(arg1) {
return cache[k];
return function (obj) {
* - <https://developer.mozilla.org/en/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug>
var keys = [],
if (hasEnumBug) {
return keys;
values = [];
for (; i < len; ++i) {
return values;
var key;
var key;
return UNDEFINED;
p = Y.Array(path),
l = p.length;
p = Y.Array(path),
ref = o;
return UNDEFINED;
var numberify = function(s) {
mobile: null,
ios: null,
secure: false,
os: null
if (ua) {
o.ios = m;
var feature_tests = {};
result = [];
if (cat_o) {
if (!feature) {
if (ua) {
return result;
YUI.Env.aliases["anim"] = ["anim-base","anim-color","anim-curve","anim-easing","anim-node-plugin","anim-scroll","anim-xy"];
YUI.Env.aliases["autocomplete"] = ["autocomplete-base","autocomplete-sources","autocomplete-list","autocomplete-plugin"];
YUI.Env.aliases["collection"] = ["array-extras","arraylist","arraylist-add","arraylist-filter","array-invoke"];
YUI.Env.aliases["dataschema"] = ["dataschema-base","dataschema-json","dataschema-xml","dataschema-array","dataschema-text"];
YUI.Env.aliases["datasource"] = ["datasource-local","datasource-io","datasource-get","datasource-function","datasource-cache","datasource-jsonschema","datasource-xmlschema","datasource-arrayschema","datasource-textschema","datasource-polling"];
YUI.Env.aliases["datatable"] = ["datatable-base","datatable-datasource","datatable-sort","datatable-scroll"];
YUI.Env.aliases["dd"] = ["dd-ddm-base","dd-ddm","dd-ddm-drop","dd-drag","dd-proxy","dd-constrain","dd-drop","dd-scroll","dd-delegate"];
YUI.Env.aliases["dom"] = ["dom-core","dom-base","dom-attrs","dom-create","dom-class","dom-size","dom-screen","dom-style","selector-native","selector"];
YUI.Env.aliases["editor"] = ["frame","selection","exec-command","editor-base","editor-para","editor-br","editor-bidi","editor-tab","createlink-base"];
YUI.Env.aliases["event"] = ["event-base","event-delegate","event-synthetic","event-mousewheel","event-mouseenter","event-key","event-focus","event-resize","event-hover"];
YUI.Env.aliases["node"] = ["node-base","node-event-delegate","node-pluginhost","node-screen","node-style"];